日期:2014-05-19  浏览次数:20858 次

怎样在windows form中控制文本框特殊字符(^|#$%)不能输入?
RT
谢谢!

------解决方案--------------------
比脚输入的asc码
------解决方案--------------------
你放在keypress里试试?
------解决方案--------------------
应该是keydown你shift一直恩着怎么回有keyup事件
------解决方案--------------------
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = "^|#$% ".IndexOf(e.KeyChar) > = 0;
}

------解决方案--------------------
我觉得你要控制人家输入什么东西,最好用正则表达式。规规矩矩,良好的习惯。 呵呵.....