Obviously this doesn't work, otherwise I wouldn't be asking, but by looking at this you should be able to see what I am trying to do. Does anyone have a solution or suggestion?
Expand|Select|Wrap|Line Numbers
- Dim x
- Dim y As New Control
- Dim z As New Control
- For x = 1 To 40
- y = "txtTextBox" & x
- z = "chkcheckBox" & x
- If y.Text = "3" Then
- z.Enabled = False
- End If
- Next
Unable to cast object of type 'System.String' to type System.Windows.Forms.Control'.
Now I know I can't refer to a control using the string combination, but thats all I could think of to get through all of my controls in a for..next.
Thanks