Wednesday, 16 March 2016

Clear multiple text boxes with a button in

 void ClearAllText(Control con)
        {
            foreach (Control c in con.Controls)
            {
                if (c is TextBox)
                    ((TextBox)c).Clear();
                else
                    ClearAllText(c);
            }
        }


To use the above code, simply do this:
ClearAllText(this);

No comments:

Post a Comment