private void txtUserName1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar >= (char)Keys.D0 && e.KeyChar <= (char)Keys.D9 || e.KeyChar == (char)Keys.Back) { e.Handled = false; } else { e.Handled = true; } ComForm.IsAlphAndNum(e); }