Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building Controls at runtime
Message
De
05/08/2004 22:37:35
 
 
À
05/08/2004 21:51:54
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00931205
Message ID:
00931211
Vues:
22
Hi, Mike,

Yes, it is. As a very basic example, here's what you would do to add a textbox at runtime...
System.Windows.Forms.TextBox oText = new System.Windows.Forms.TextBox();
this.Controls.Add(oText);
oText.Visible = true;
oText.Top = 5;
In that example, I'm just using the base text control. If you've subclassed your textbox, you'd want to specify your textbox class instead.

You can also add a series of controls by using this.Controls.AddRange()

Actually, if you look at the Winform Designer generated code, that should give you ideas as to how it's done, because the controls you drop onto the form at designtime are added at runtime using 'this.Controls.Add'.

Hope that helps...
Kevin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform