1 private void XXXXX_KeyPress(object sender, KeyPressEventArgs e)
2 {
3 //只能输入数字,回车和退格键
4 if ((e.KeyChar < 48 || e.KeyChar > 57) && e.KeyChar != 8 && e.KeyChar != 13)
5 {
6 e.Handled = true;
7 }
8 }

 

posted on 2013-11-06 10:26  西城诸葛  阅读(377)  评论(0编辑  收藏  举报