Gruppe
Dialog
Problem
Die Aufschriften und die Anzahl der ausgewählten CheckBoxes sollen ermittelt werden.
ClassModule: frmCheckBoxes
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdValues_Click()
Dim cnt As Control
Dim arr() As String
Dim iCounter As Integer
For Each cnt In Controls
If UCase(TypeName(cnt)) = "CHECKBOX" Then
If cnt.Value Then
iCounter = iCounter + 1
ReDim Preserve arr(1 To iCounter)
arr(iCounter) = cnt.Caption
End If
End If
Next cnt
MsgBox "Ausgewählt: " & iCounter
For iCounter = 1 To UBound(arr)
MsgBox iCounter & ". Auswah: " & arr(iCounter)
Next iCounter
End Sub
StandardModule: Modul1
Sub CallForm()
frmCheckBoxes.Show
End Sub