csharp clear all textboxes

Code Example - csharp clear all textboxes

                
                        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);
 }
                    
                
 

csharp clear a textbox

                        
                                // Method 1: Use clear method
Textbox.clear();
// Method 2: Set text to string.Empty
Textbox.Text = string. Empty;
// Method 3: Set text to blank
Textbox.Text = "";
                            
                        
 

Related code examples