Validation of textbox for entering only digits

private void txtbox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            //MessageBox.Show(Convert.ToInt32(e.KeyChar).ToString());   
            if (Convert.ToInt32(e.KeyChar) == 8)
                return;
            if (char.IsDigit(e.KeyChar) == false)
            {
                MessageBox.Show("Enter numerics only");
                e.Handled = true;
            }
        }
Ebook Download
View all
Learn
View all