C# Form Operation Function - clear controls of a windowsform
private void clearcontrl()
{
foreach (Control c in this.Controls)
{
if (c.GetType().Name == "GroupBox" || c.GetType().Name == "CustomGroupBox")
{
clearControls(c);
}
else if (c.GetType().Name == "TextBox")
{
((TextBox)c).Text = "";
}
else if (c.GetType().Name == "CustomTextBox")
{
((CustomControls.CustomTextBox)c).Text = "";
}
else if (c.GetType().Name == "ComboBox")
{
if (((ComboBox)c).Items.Count > 0)
{
((ComboBox)c).SelectedIndex = 0;
}
}
}
}


