private void CleanForm()
{
foreach (var c in this.Controls)
{
if (c is TextBox)
{
((TextBox)c).Text = String.Empty;
}
And this for clearing all controls in form like textbox, checkbox, radioButton
you can add different types you want..
private void ClearTextBoxes(Control control)
{
foreach (Control c in control.Controls)
{
if (c is TextBox)
{
((TextBox)c).Clear();
}
if (c.HasChildren)
{
ClearTextBoxes(c);
}
if (c is CheckBox)
{
((CheckBox)c).Checked = false;
}
if (c is RadioButton)
{
((RadioButton)c).Checked = false;
}
}
}