首先引用
Win Form中限制TextBox只能输入数字using System.Text.RegularExpressions;
给TextBox添加KeyPress事件,代码如下:
Win Form中限制TextBox只能输入数字private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        }

相关文章: