[RESOLVED] using variables in control names
Hello,
I'm pretty new to VB
I would like loop through control names at run time. Is it possible to do something like the following:
Code:
Dim n As Integer
n = 0
For n 0 to 15
Textbox1.Text &= CStr(button(n).name & Environment.Newline
next n
Is something like this possible? If so, what is the correct syntax?
Thank you
Re: using variables in control names
You would have to create a control array to do something like the above.
You can use a for each loop to loop through the controls on a given form or panel and get something like you seem to be looking for.
Re: using variables in control names
Code:
For Each ctrl As Control In Me.Controls
MsgBox(ctrl.Name)
Next
Re: using variables in control names
Thank you,
I created a control array and it did the trick