private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (!(char.IsNumber(e.KeyChar)) && e.KeyChar != (char)8) { e.Handled = true; } }
参考:https://blog.csdn.net/weixin_43653287/article/details/91350311
2023-10-19 16:25:52
private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (!(char.IsNumber(e.KeyChar)) && e.KeyChar != (char)8) { e.Handled = true; } }
参考:https://blog.csdn.net/weixin_43653287/article/details/91350311