Clear Form Text Box - CSharp System.Windows.Forms

CSharp examples for System.Windows.Forms:TextBox

Description

Clear Form Text Box

Demo Code


using System.Windows.Forms;
using System.Globalization;
using System;/*from w  w w. j av a2  s  .  c  om*/

public class Main{
        public static void ClearTextBox(Control ctrl)
        {
            foreach (Control c in ctrl.Controls)
            {
                var textBox = c as TextBox;
                if (textBox != null)
                {
                    textBox.Clear();
                }
                if (c.HasChildren)
                {
                    ClearTextBox(c);
                }
            }
        }
}

Related Tutorials