僅供參考,劣者的想法是把判別式拆開來
語法:
Option Explicit
Private Sub cmdTry_Click()
Dim A$, B$, C$
Dim JetDouble As String
A$=Text1.text
B$=Text2.text
C$=Text3.text
If JetTrue_All_7(A$,B$,C$) Then
JetDouble = "10"
ElseIf JetTrue_Two_7(A$,B$,C$) Then
JetDouble = "3"
ElseIf JetTrue_All_Same(A$,B$,C$) Then
JetDouble = "5"
ElseIf JetTrue_Two_Same(A$,B$,C$) Then
JetDouble = "2"
End If
End Sub
Private Function JetTrue_All_7(Byval Jet1 as String,Byval Jet2 as String,Byval Jet3 as String) As Boolean
JetTrue_All_7 = Trim(Jet1$) = Trim(Jet2$) And Trim(Jet1$) = Trim(Jet3$) And Trim(Jet1$) = "7"
End Function
Private Function JetTrue_Two_7(Byval Jet1 as String,Byval Jet2 as String,Byval Jet3 as String) As Boolean
JetTrue_Two_7 = (Trim(Jet1$) = Trim(Jet2$) Or Trim(Jet1$) = Trim(Jet3$)) And Trim(Jet1$) = "7"
End Function
Private Function JetTrue_All_Same(Byval Jet1 as String,Byval Jet2 as String,Byval Jet3 as String) As Boolean
JetTrue_All_Same = Trim(Jet1$) = Trim(Jet2$) And Trim(Jet1$) = Trim(Jet3$)
End Function
Private Function JetTrue_Two_Same(Jet1$, Jet2$, Jet3$) As Boolean
JetTrue_Two_Same = Trim(Jet1$) = Trim(Jet2$) Or Trim(Jet1$) = Trim(Jet3$) Or Trim(Jet2$) = Trim(Jet3$)
End Function