2012年4月5日

关于textbox的限制输入(C#代码)

摘要: 最近做C#winform 要求只能输入小数,所以测试了几回,用下来不错,博友觉得有用的话,就收藏一下! private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { string skey = TxB_A1.Text.Trim(); if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar)&&e.KeyChar!=46) { //只能输入数字或者小数点,还有使用退格键 e.Handled = true; } else if (e.KeyChar == 阅读全文

posted @ 2012-04-05 14:37 sanglei 阅读(669) 评论(3) 推荐(2) 编辑

导航