ClearControls

public static void ClearControls(this System.Windows.Forms.Form form)
{
   foreach(var item in form.Controls)
   {
      if (item is TextBox)
         (item as TextBox).Text = "";
      
      if (item is ComboBox)
         (item as ComboBox).SelectedIndex = -1;

      //if (item is ...)
   }

}
Example:
//In a button 'Reset' click event in a WinForm

this.ClearControls();

Description

clean the controls on a form. Please send suggestions.

Details

Double click on the code to select all.

 

;