控制textbox里边只输入数字
控制textbox里边只输入数字 void textboxnum(KeyPressEventArgs e) { if ((e.KeyChar > (char)47 && e.KeyChar < (char)58) || e.KeyChar == (char)8) { e.Handled = false; } else { e.Handled = true; } } private void TEXTBOX1_KeyPress(object sender, KeyPressEventArgs e) { textboxnum(e); }