查看單個文章
舊 2006-05-22, 10:42 AM   #2 (permalink)
劍痞憶秋年
長老會員
 
劍痞憶秋年 的頭像
榮譽勳章
UID - 15
在線等級: 級別:31 | 在線時長:1096小時 | 升級還需:56小時級別:31 | 在線時長:1096小時 | 升級還需:56小時級別:31 | 在線時長:1096小時 | 升級還需:56小時級別:31 | 在線時長:1096小時 | 升級還需:56小時級別:31 | 在線時長:1096小時 | 升級還需:56小時級別:31 | 在線時長:1096小時 | 升級還需:56小時
註冊日期: 2002-12-06
住址: 步雲崖
文章: 280
精華: 0
現金: 15847 金幣
資產: 20867 金幣
預設

僅供參考,劣者的想法是把判別式拆開來

語法:
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
__________________
一切有為法 如夢幻泡影
如露亦如電 應作如是觀
劍痞憶秋年 目前離線  
送花文章: 150, 收花文章: 33 篇, 收花: 130 次
回覆時引用此帖