我想知道我錯什麼,可以教教我嘛~謝謝~
我的frm 有option 1 to option 11
若果user 沒有click option的話,便會出現msgbox
但不知何解click 了option 依然會出現msgbox
我已經看過舊文章,好像沒有類似問題
煩請相告~~
Private Sub Option1_Click(Index As Integer)
Dim shadow As Integer
Dim lbl_set
lbl_set = Array("true", "true", "true", "true", "true", "true", "true", "true", "true", "true", "true")
End Sub
Private Sub cmdAdd_Click()
Dim a As String
Dim m_Button As VbMsgBoxResult
If lbl_set = False Then
MsgBox "You haven't select the item type", 16 + vbOKOnly, "Error"
Exit Sub
End If
End Sub
我的frm 有option 1 to option 11
若果user 沒有click option的話,便會出現msgbox
但不知何解click 了option 依然會出現msgbox
我已經看過舊文章,好像沒有類似問題
煩請相告~~
Private Sub Option1_Click(Index As Integer)
Dim shadow As Integer
Dim lbl_set
lbl_set = Array("true", "true", "true", "true", "true", "true", "true", "true", "true", "true", "true")
End Sub
Private Sub cmdAdd_Click()
Dim a As String
Dim m_Button As VbMsgBoxResult
If lbl_set = False Then
MsgBox "You haven't select the item type", 16 + vbOKOnly, "Error"
Exit Sub
End If
End Sub
文章標籤
全站熱搜

lbl_set要定義在[一般]或[模組/public]中,才可以通用!
UM~ 首先多謝阿戊賜教,但抱歉我依然做不到~ 我已經改作這樣的了 但我有一個疑問,我在lbl_set=array("true",..... 這行語法有沒有錯 ?我想要的結果是option1=true 另外我set 了as integer ,但"true"應該是string 但我改作string vb 卻說我錯~ 多謝解答~~~ Public lbl_set As Integer Private Sub Option1_Click(Index As Integer) Dim shadow As Integer lbl_set = Array("true", "true", "true", "true", "true", "true", "true", "true", "true", "true", "true") End Sub Private Sub cmdAdd_Click() Dim a As String Dim m_Button As VbMsgBoxResult If lbl_set = False Then MsgBox "You haven't select the item type", 16 + vbOKOnly, "Error" Exit Sub End If End Sub
1: lbl_set的定義不對==>lbl_set() 2: 在 Array()之後 lbl_set會產生陣列索引值,而不是直接使用 lbl_set 如 lbl_set(0),lbl_set(1)..... 3:上面的問題姑且不論...只見你array()之中全是true 又怎會蹦出 false ?
Private Sub Command1_Click() Dim checking As Boolean For i = 1 To Option1.count checking = checking Or Option1(i - 1) Next If checking Then Print "ok" End Sub
昨晚我想通了~~~ 多謝各位朋友解答~我是這樣寫的 Private Sub Option1_Click(Index As Integer) check = 0 Select Case Index Case 0 print = "1" Case 1 print"2" Case 2 print"3" end select end sub