發問時間: 電腦與網際網路程式設計 · 10 年前

vb6 陣列應用

請問一下

例如舉例3個check:

if check1.value=1 and check2.value=1 and check3.value=1 then check4.value=1

如果1~3全部都打勾那麼4就會自動打勾, 如果其中一個沒打勾, 那麼4就取消打勾

----

如果把4打勾, 那麼1~3全部都會自動打勾

 

說簡單點我是想做全選功能拉XD

該怎麼使用陣列完成呢@@?

已更新項目:

感謝W.J.S大大~

功能就是我想要的

可是我想改為陣列用法要如何使用呢

目前

Private Sub Check1_Click(Index As Integer)

Select Case Index

Case 3

For i = 0 To 2

Check1(i).Value = 1

Next

End Select

End Sub

目前只能這樣全選

我實在想不出該怎麼用才能像您一樣的功能

陣列不知道能不能@@

1 個解答

評分
  • W.J.S.
    Lv 7
    10 年前
    最佳解答

    Private Sub Check1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Check4 = -(Check1 + Check2 + Check3 = 3)

    End SubPrivate Sub Check2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Check4 = -(Check1 + Check2 + Check3 = 3)

    End SubPrivate Sub Check3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Check4 = -(Check1 + Check2 + Check3 = 3)

    End SubPrivate Sub Check4_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Check1 = Check4: Check2 = Check4: Check3 = Check4

    End Sub

    2011-05-24 23:39:32 補充:

    Private Sub Check1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

    Select Case Index

    Case 3

    For i = 0 To 3

    Check1(i) = Check1(3)

    Next

    Case Else

    Check1(3) = -(Check1(0) + Check1(1) + Check1(2) = 3)

    End Select

    End Sub

還有問題?馬上發問,尋求解答。