AspireTech
New member
- Joined
- Oct 21, 2007
- Messages
- 1
- Programming Experience
- 3-5
Does anyone know how I can reference a UserControl using a string value? Here is what I am trying to do.
I need to be able to add a usercontrol to a form when a button is pressed, all of the form controls are being built at runtime based on records in an SQL table.
Below is the code I'm using to open the new user control. I need to be able to specify which UserControl to open based on an SQL record.
Thanks.
-Scott
Dim opnMenu As New UserControl
//where UserControl is the name of my actual control, from example MainMenu//
Me.Parent.Controls.Add(opnMenu)
opnMenu.Show()
Me.Parent.Controls.Remove(Me)
I need to be able to add a usercontrol to a form when a button is pressed, all of the form controls are being built at runtime based on records in an SQL table.
Below is the code I'm using to open the new user control. I need to be able to specify which UserControl to open based on an SQL record.
Thanks.
-Scott
Dim opnMenu As New UserControl
//where UserControl is the name of my actual control, from example MainMenu//
Me.Parent.Controls.Add(opnMenu)
opnMenu.Show()
Me.Parent.Controls.Remove(Me)