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