C#中 textbox只允许整数输入

来源:互联网 发布:千兆端口和百兆端口 编辑:程序博客网 时间:2024/04/28 17:51

Key Press事件

private void textBox1_KeyPress(object sender, KeyPressEventArgs e){     if (e.KeyChar >= 31 && (e.KeyChar < '0' || e.KeyChar > '9')) { e.Handled = true; }}


原创粉丝点击