You Tube

Thursday 5 January 2017

How to clear all text Boxes in c#?

Put this function in your source code and call from somewhere it's needed.
private void clear_txt_boxes()
        {
            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);
        }

Get data from two different tables in MS SQL

Try this...
Select a.id, a.name,b.adrs from table1 a, table2 b

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