Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question about referencing a control at runtime
Message
De
28/02/2004 20:22:58
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Question about referencing a control at runtime
Divers
Thread ID:
00881833
Message ID:
00881833
Vues:
54
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform