winform设置textbox只能输入数字
作者:互联网
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
标签:Handled,KeyChar,private,char,textBox1,csdn,winform,输入,textbox 来源: https://www.cnblogs.com/masha2017/p/15131671.html