文本框 只输入数字键和删除键
private void txtLXDH_KeyPress(object sender, KeyPressEventArgs e) { e.Handled = true; int input = Convert.ToInt32(e.KeyChar); if ((input <= 57 && input >= 48) || input == 8) { e.Handled = false; } }