private void textBox_name_KeyPress(object sender, KeyPressEventArgs e)
{
string s = e.KeyChar.ToString();
Regex reg = new Regex("^([A-Za-z0-9]|[!@#$%^&*()])$");
bool flag = reg.Match(s).Success;
e.Handled = !flag;
}
winform TextBox限制只能输入英文字符、数字、特殊字符
最新推荐文章于 2024-10-15 12:43:14 发布