1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Private Sub CheckBox1_Click()
'Clic-droit sur case à cocher=>Visualiser le code
If Me.CheckBox1 = True Then
'si la case 1 est cochée
MsgBox "OK1"
Else
MsgBox "Bof1"
End If
End Sub
Private Sub CheckBox2_Click()
If Me.CheckBox2 Then
'si la case 2 est cochée (identique, mais plus court qu 1)
MsgBox "OK2"
Else
MsgBox "Bof2"
End If
End Sub
Private Sub CommandButton1_Click()
Dim Tot As Integer
Dim C As Control
For Each C In Me.Controls
'pour chaque controle dans l'USF
If UCase(C.Name) Like "CH*" Then
'si son nom commence par CH
Tot = Tot + IIf(C = True, 1, 0)
's'il est coché, on ajoute 1, sinon, 0
End If
Next C
MsgBox Tot
Unload Me
'on ferme le USF
End Sub |
Partager