String Name to a User Control?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I have a string field that contains the name of a User Control, how could
I access the User Control? I need something like the following function:

dim ucUC as UserControl
Dim strUC as string

strUC = "MyUserControl"
ucUC = ToUserControl(strUC) 'Which would be the same as ucUC = MyuserControl

Thanks for your help.
Dave
 
WHy not build your function referencing the type of control it is? Instead
of trying to pass it as a string.

Sub TESTME(ByVal thiscontrol as UserControl)
 
I've got a menu displayed for the user. They select what screen they want to
see. I've got the name of the User Control stored in the TAG property for
each entry in the menu. They click the menu item, I've got the string name,
now I need to bring up the User Control. Hence the need for the function.....

Dave
 
OpenMeCauseItWasChosen(UserControl)

Function OpenMeCauseItWasChosen(ByVal thiscontrol As UserControl) As Boolean
If thisform.Tag = "OPENTHISONE" Then
thisform.Show()
End If
Return True
End Function
 
Back
Top