Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Baseclass property?
Message
De
09/11/2002 10:30:51
 
 
À
09/11/2002 09:00:48
Christian Cote
Les Logiciels Onoma Inc.
Longueuil, Québec, Canada
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00720621
Message ID:
00720633
Vues:
11
This message has been marked as the solution to the initial question of the thread.
Hi Christian,

You can query an object's type this way:
foreach(System.Windows.Forms.Control  oControl in this.Controls)
{
	if (oControl is TextBox)
	{
	  oControl.DataBindings.Clear();
	}

}
~~Bonnie



>HI,
>I want to iterate through my winform in order to find out the textbox controls and Clear() their DataBindings. The way I do it is:
>
>foreach(System.Windows.Forms.Control oControl in this.Controls)
>{
> if (oControl.Name.StartsWith("txt"))
> {
> oControl.DataBindings.Clear();
> }
>
>}
>
>Is there a Baseclass property or something like this because I find it a bit cumbersome to identify a control's type by its name.
>
>Thank you for your help,
>Christian
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform