我有一个文本框,应该禁止进入任何特殊字符。
用户可以输入:
A-Z A-Z 0-9 空格我怎样才能让的KeyDown
事件来做到这一点?
私人无效_txtPath_KeyDown(对象发件人,KeyEventArgs E)
{
如果((e.Key< Key.A)||(e.Key> Key.Z))
e.Handled =真实;
}
I have a textbox that should disallow entering any special characters.
The user can enter :
A-Z a-z 0-9 SpaceHow can I make the KeyDown
event to do this?
private void _txtPath_KeyDown(object sender, KeyEventArgs e)
{
if ((e.Key < Key.A) || (e.Key > Key.Z))
e.Handled = true;
}