-
October 11th, 2011, 09:57 AM
#1
[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
-
October 11th, 2011, 10:11 AM
#2
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.
Always use [code][/code] tags when posting code.
-
October 11th, 2011, 12:04 PM
#3
Re: using variables in control names
Code:
For Each ctrl As Control In Me.Controls
MsgBox(ctrl.Name)
Next
-
October 11th, 2011, 12:04 PM
#4
Re: using variables in control names
Thank you,
I created a control array and it did the trick
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|