Home All Groups Group Topic Archive Search About

String Name to a User Control?

Author
16 May 2006 9:42 PM
Dave
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

Author
17 May 2006 10:43 AM
vbnetdev
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)

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Show quoteHide quote
"Dave" <D***@discussions.microsoft.com> wrote in message
news:E411A9A1-F19D-45F9-B33C-0721243F5391@microsoft.com...
> 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
>
Author
17 May 2006 3:23 PM
Dave
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


Show quoteHide quote
"vbnetdev" wrote:

> 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)
>
> --
> Get a powerful web, database, application, and email hosting with KJM
> Solutions
> http://www.kjmsolutions.com
>
>
>
> "Dave" <D***@discussions.microsoft.com> wrote in message
> news:E411A9A1-F19D-45F9-B33C-0721243F5391@microsoft.com...
> > 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
> >
>
>
>
Author
17 May 2006 3:51 PM
vbnetdev
OpenMeCauseItWasChosen(UserControl)

Function OpenMeCauseItWasChosen(ByVal thiscontrol As UserControl) As Boolean
        If thisform.Tag = "OPENTHISONE" Then
            thisform.Show()
        End If
Return True
    End Function
--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Show quoteHide quote
"Dave" <D***@discussions.microsoft.com> wrote in message
news:A98BDC28-687C-42B3-BE34-20D409555856@microsoft.com...
> 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
>
>
> "vbnetdev" wrote:
>
>> 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)
>>
>> --
>> Get a powerful web, database, application, and email hosting with KJM
>> Solutions
>> http://www.kjmsolutions.com
>>
>>
>>
>> "Dave" <D***@discussions.microsoft.com> wrote in message
>> news:E411A9A1-F19D-45F9-B33C-0721243F5391@microsoft.com...
>> > 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
>> >
>>
>>
>>
Author
17 May 2006 3:54 PM
vbnetdev
sorry it should be thiscontrol not thisform.

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Show quoteHide quote
"vbnetdev" <vbnetdev@community.nospam> wrote in message
news:%23iRT7mceGHA.3792@TK2MSFTNGP03.phx.gbl...
> OpenMeCauseItWasChosen(UserControl)
>
> Function OpenMeCauseItWasChosen(ByVal thiscontrol As UserControl) As
> Boolean
>        If thisform.Tag = "OPENTHISONE" Then
>            thisform.Show()
>        End If
> Return True
>    End Function
> --
> Get a powerful web, database, application, and email hosting with KJM
> Solutions
> http://www.kjmsolutions.com
>
>
>
> "Dave" <D***@discussions.microsoft.com> wrote in message
> news:A98BDC28-687C-42B3-BE34-20D409555856@microsoft.com...
>> 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
>>
>>
>> "vbnetdev" wrote:
>>
>>> 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)
>>>
>>> --
>>> Get a powerful web, database, application, and email hosting with KJM
>>> Solutions
>>> http://www.kjmsolutions.com
>>>
>>>
>>>
>>> "Dave" <D***@discussions.microsoft.com> wrote in message
>>> news:E411A9A1-F19D-45F9-B33C-0721243F5391@microsoft.com...
>>> > 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
>>> >
>>>
>>>
>>>
>
>