how to use one clear method for all forms in project for clearing all textboxes text.

Hello,

I found this, haven't tested it, but it might work:

public void ClearTextBoxes(Control control)

{

foreach (Control c in control.Controls)

{

if (c is TextBox)

{

((TextBox)c).Clear();

}

if (c.HasChildren)

{

ClearTextBoxes(c);

}

}

}

Hope it helps. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.