clean(This.FindForm())//调用
public static void clean(Form form ) //接收Form窗体
{
for (int i = 0; i < form.Controls.Count; i++)
{
foreach (Control control in form.Controls[i].Controls)
{
if (control is TextBox)
{
(control as TextBox).Text = "";
}
if (control is CheckBox)
{
(control as CheckBox).Checked = false;
}
if (control is ComboBox)
{
(control as ComboBox).SelectedIndex = 0;
}
//其它控件类似以上操作即可
}
}
}