Tuesday, 23 April 2013

TextBox take only numeric in c# Code Behind

 private void vtbPhno_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                if (char.IsDigit(e.KeyChar) == false)
                    e.Handled = true;
                else
                    e.Handled = false;
            }
            catch (Exception)
            {
                e.Handled = false;
            }
        }

No comments:

Post a Comment