摘要:
comboBox1.Text 是框里面 显示的 文本comboBox1.SelectedItem.ToString() 是 选择的文本区别是 有时候 可以 不选择,自己 直接 输入. 所以 用 comboBox1.Text 比较好comboBox1.SelectedItem.ToString() 是 一定要选择 才有的如果没有选择,Text是空的,直接用comboBox1.SelectedItem.ToString() 会报错的所以建议用comboBox1.Text 阅读全文
posted @ 2011-07-03 16:49
孤獨龍
阅读(1515)
评论(0)
推荐(0)
摘要:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if(!char.IsDigit(e.KeyChar)) e.Handled = true; //'\b'是退格键值 if(e.KeyChar=='\b'||e.KeyChar=='.') e.Handled = false; }以上代码是无法限制全角数字输入的.而在项目中全角数字是不能算真正的数字,因为在参加计算时全角可能会出错.修改的代码:private void textBox1_KeyPress(obj 阅读全文
posted @ 2011-07-03 16:46
孤獨龍
阅读(184)
评论(0)
推荐(0)