Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Baseclass property?
Message
From
09/11/2002 10:30:51
 
 
To
09/11/2002 09:00:48
Christian Cote
Les Logiciels Onoma Inc.
Longueuil, Quebec, Canada
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00720621
Message ID:
00720633
Views:
10
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform