Maskedtexbox用于姓氏 [英] Maskedtexbox for lastname
本文介绍了Maskedtexbox用于姓氏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个lastname的maskedtextbox,我已经编写了特殊符号的代码。但现在我想在其中允许撇号(')和连字符( - )。有办法吗?
如果是,请帮我理解代码。
我在C#(VS2013)上写它。
我尝试过:
I have a maskedtextbox for lastname, I have written code for the special symbols. But now i want to allow apostrophe(') and hyphen(-) in it. Is there a way to do it?
If yes please help me understand the code.
I am writing it on C#(VS2013).
What I have tried:
private void maskedTextBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == ' ')
e.KeyChar = (char)0;
}
推荐答案
好吧, Google [ ^ ]非常有帮助!
第一个结果: c# - 仅允许文本框中的特定字符 - Stack Overflow [ ^ ] - 检查Icemanind
回答并改变你的需求。
Well, Google[^] is very helpful!
First result: c# - Only allow specific characters in textbox - Stack Overflow[^] - checkIcemanind
answer and change to your needs.
这篇关于Maskedtexbox用于姓氏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文