I need to loop through a bunch of textbox controls on my form. The
order of the loop is very important. For example, the top one must be
read first, then the one below it, etc.
My first attempt was to put the controls in a Panel, and then loop
through the controls collection of the panel. What happened is it read
the controls from the bottom of my form to the top!
So I tried a more manual process. I named each textbox like this:
Textbox_1
Textbox_2
Textbox_3
Then tried a loop unsuccessfully:
For i as integer = 0 to 10
If Textbox_ & i.Text <> "" Then
'do something
End If
Next
This isn't exactly what i'm doing, but the idea is the same. Textbox_ &
i is causing an error because vb is reading it as a string. I need it
to be a control.
I know i'm missing something very obvious, but I just can't figure this
out!
Any ideas?
Thanks for all your help!
John