foreach (Control ctrl in this.Controls)
{
if (ctrl is TextBox)
{
((TextBox)ctrl).Clear();
}
}
--
Tim Wilson
.Net Compact Framework MVP
<CobraS...@al.com> wrote in message
news:bumcgo$sbl$1...@newsg3.svr.pol.co.uk...
>
>
>
Note: This won't clear nested textboxes...
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
--
Tim Wilson
.Net Compact Framework MVP
"Herfried K. Wagner [MVP]" <hirf-spa...@gmx.at> wrote in message
news:bumgpd$jcp8p$2...@ID-208219.news.uni-berlin.de...
No problem -- it was only a little note -- maybe a "TODO" for the OP...
;-)
private void button1_Click(object sender, System.EventArgs e)
{
ClearAllTextBoxes(this);
}
private void ClearAllTextBoxes(Control parent)
{
if (parent is TextBox)
{
((TextBox)parent).Clear();
}
foreach (Control ctrl in parent.Controls)
{
ClearAllTextBoxes(ctrl);
}
}
... I am easily susceptible to peer pressure :)
--
Tim Wilson
.Net Compact Framework MVP
"Herfried K. Wagner [MVP]" <hirf-spa...@gmx.at> wrote in message
news:bumkjq$j99fv$2...@ID-208219.news.uni-berlin.de...