Hello I have a code but i dont understand it. Who can explain it for me with comments. There are three check boxes, three labels and one timer in the form The code: - Dim s As Integer
-
-
Private Sub Check1_Click(Index As Integer)
-
If Check1(Index) = 1 Then
-
Label1(Index).Visible = True
-
Else
-
Label1(Index).Visible = False
-
End If
-
End Sub
-
-
Private Sub Form_Load()
-
s = 0
-
End Sub
-
-
Private Sub Timer1_Timer()
-
j = s
-
For i = 0 To 2
-
k = jMod2
-
Check1(i).Value = k
-
j = j - k
-
j = j \ 2
-
Next i
-
s = (s + 1) Mod 8
-
End Sub
You failed to mention that the checkboxes and labels were in two conrtrol arrays. :)
The Check1_Click routine is simply showing or hiding each label when its corresponding checkbox is checked or unchecked, respectively.
The timer appears to be switching between all possible combinations of settings for the three checkboxes.
Note, I believe the "
jMod2" is a typo - it almost certainly should be "
j Mod 2". At least, I had to change it to get the code to look as though it was working. You really should start your code with "Option Explicit" (or check Tools | Options | Require Variable Declaration) to prevent this sort of glitch.