You Tube

Thursday 5 January 2017

How to clear the text of all textBoxes in the form?

This will work fine... 
private void ClearTextBoxes()
 {
     Action<Control.ControlCollection> func = null;

     func = (controls) =>
         {
             foreach (Control control in controls)
                 if (control is TextBox)
                     (control as TextBox).Clear();
                 else
                     func(control.Controls);
         };

     func(Controls);
 }

No comments:

Post a Comment