private void Text2_KeyPress(System.Object _sender, System.Windows.Forms.KeyPressEventArgs _e1) { int KeyAscii = (short)(_e1.KeyChar); if (!((KeyAscii >= (short)("0"[0]) && KeyAscii <= (short)("9"[0]) || KeyAscii == Keys.Back || KeyAscii == Keys.KeyDelete || KeyAscii == Keys.Space || KeyAscii == Keys.Return))) { MessageBox.Show("Maaf Hanya Boleh Diisi Angka Saja", "Perhatian", MessageBoxButtons.OK, MessageBoxIcon.Information); KeyAscii = 0; Text2.Focus(); } }