Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question about referencing a control at runtime
Message
From
28/02/2004 20:22:58
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Question about referencing a control at runtime
Miscellaneous
Thread ID:
00881833
Message ID:
00881833
Views:
53
I have a situation where I need to dynamically add a container onto a form, where I won't know the name of the container at designtime.

If I knew that the name of my container is UserControl1, I'd be doing something like the following in my form...

UserControl1 oControl = new UserControl1();
oControl.BringToFront();
oControl.Refresh();

this.Controls.AddRange(new System.Windows.Forms.Control[] {
oControl});


I'm writing this code as generic code in a form class, so I won't know the name of the container. I know that Rick Strahl has the stuff on his site for dynamic code evaluation, and was wondering if that's the way to go, or if there's a simpler way.

Thanks,
Kevin
Next
Reply
Map
View

Click here to load this message in the networking platform