(word)c#部分问题解决方法.docVIP

  • 16
  • 0
  • 约1.91万字
  • 约 17页
  • 2016-08-01 发布于北京
  • 举报
(word)c#部分问题解决方法

TextBox中只能输入数字的几种常用方法(C#) private void tBox_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 0x20) e.KeyChar = (char)0; //禁止空格键 if ((e.KeyChar == 0x2D) (((TextBox)sender).Text.Length == 0)) return; //处理负数 if (e.KeyChar 0x20) { try { double.Parse(((TextBox)sender).Text + e.KeyChar.ToString()); } catch { e.KeyChar = (char)0; //处理非法字符 } } } private void TextBox

文档评论(0)

1亿VIP精品文档

相关文档