|
-
Dec 19th, 2003, 10:03 AM
#1
Thread Starter
Hyperactive Member
Reference a control by name...[RESOLVED]
Hey everyone,
I feel like an idiot asking this but...
I have a collection of controls that I add to my form programmatically, and was wondering how I can refer to specific controls by name? I'd rather not loop through the controls collection and compare names, since there could be many of these controls.
Thanks,
Ben
Last edited by BenFinkel; Dec 22nd, 2003 at 12:11 PM.
-
Dec 19th, 2003, 11:08 AM
#2
Junior Member
Try putting them in a HashTable:
Dim oControl As New Hashtable()
' Add controls
oControl.Add("name1", TextBox1)
oControl.Add("name2", TextBox2)
oControl.Add("name3", TextBox3)
dim t as textbox
t = oControl("name1)
Fred
-
Dec 22nd, 2003, 12:11 PM
#3
Thread Starter
Hyperactive Member
Thanks Fred, worked perfectly!
--Ben
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
|