473,462 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

String Name to a User Control?

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

May 16 '06 #1
4 1282
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" <Da**@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.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

May 17 '06 #2
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" <Da**@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.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


May 17 '06 #3
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" <Da**@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.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" <Da**@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.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
>


May 17 '06 #4
sorry it should be thiscontrol not thisform.

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

"vbnetdev" <vb******@community.nospam> wrote in message
news:%2****************@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" <Da**@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.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" <Da**@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.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
>


May 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: H | last post by:
This is a question that has haunted me for quite some time. if you build a 4 tier database application where the 4th tier is the database server (MS SQL 2000), where do you build the connection...
7
by: grandeandy | last post by:
I have been racking my brain out trying to get this to work... (I am new to javascript)... Below is what I am trying to accomplish. I want to have the areas with +txt+ to have the user defined...
3
by: carl.barrett | last post by:
Hi, I have a number of buttons on a form which run mailmerges. Next to each button is a text box/control that the user enters a date into when the letter was created/merged. When the user...
6
by: tshad | last post by:
In my User control, I tried to do this: *************************************************************************** <Script runat="server"> Public ClientName As String = "<!-- #include file =...
10
by: Wouter vanEck | last post by:
Hi, I need to find a way to read a html type string from a database and add it to a placeholder control on the page and then I need to be able to populate the fields that were in that html...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
10
by: dba123 | last post by:
Why am I getting this error for Budget? Error: An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code Additional information: String was not...
4
by: kevin | last post by:
Hi, I am trying to create a page so the user can browse the network, select a file and have that file name (text) inserted into our sql DB so I can build the hyperlink path later on. Here's what...
1
by: Aur_Ros | last post by:
I am trying to get a string that contains the HTML code generated for a table control, Need help, examples about how to use render method and string builder, Thanks !!!
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.