M
Mason
I want to do a for loop through 45 check boxes, whose names are
CheckBox1 ... CheckBox 45. I'd like to do something like this:
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
Dim i As Integer
Dim strCheckBox As String
For i = 1 To 45
strCheckBox = "CheckBox" & i
test = strCheckBox
If '***strCheckBox.Checked=True***
MsgBox(strCheckBox & "=True")
End If
Next
End Sub
I can't figure out how to reference a checkbox when I have only its
name. It should be a fairly simple piece of code, but I just can't
find it. Any help would be appreciated.
Thanks,
MW
CheckBox1 ... CheckBox 45. I'd like to do something like this:
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
Dim i As Integer
Dim strCheckBox As String
For i = 1 To 45
strCheckBox = "CheckBox" & i
test = strCheckBox
If '***strCheckBox.Checked=True***
MsgBox(strCheckBox & "=True")
End If
Next
End Sub
I can't figure out how to reference a checkbox when I have only its
name. It should be a fairly simple piece of code, but I just can't
find it. Any help would be appreciated.
Thanks,
MW