Wednesday, 12 December 2012

integer validation in c#.net

 private void txtQuantity_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (char.IsDigit(e.KeyChar) == false && char.IsControl(e.KeyChar) == false)
            {
                MessageBox.Show("You can enter only number.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtQuantity.Clear();
                txtQuantity.Focus();
                e.Handled = true;
            }
        }

No comments:

Post a Comment