c#文本框
在c#文本框中想光输入数字,比如,电话:12312356454,在这个文本框里面不可以输字母或者其他的,请高手告诉我这个代码这么编?
[解决办法]
- C# code
private void txtTest_KeyPress(object sender, KeyPressEventArgs e) { if ((e.KeyChar < 48 || e.KeyChar > 57) && e.KeyChar != 8 && e.KeyChar != 13) //按下的键不是0-9也不是退格和回车 { //do nothing e.Handled = true; }}