2015-12-08 104 views

回答

6

根据我发现here可以设置TextMaskFormat,物业给MaskFormat.ExcludePromptAndLiterals。这应该是你的解决方案。

MaskFormat -Enumeration包含MaskedTextBox的一些“选项”。
它们是:

  1. ExcludePromptAndLiterals只返回用户的文本输入。
  2. IncludeLiterals返回用户输入的文本以及掩码中定义的任何文字字符。
  3. IncludePrompt返回用户输入的文本以及提示符的任何实例。
  4. IncludePromptAndLiterals返回用户输入的文本以及掩码中定义的任何文字字符和提示字符的任何实例。

默认手动是 IncludeLiterals

0

尝试maskedTextBox.TextMaskFormat属性设置为 MaskFormat.ExcludePromptAndLiterals

+0

“试试”而不加解释应该是评论。 –

+0

这不提供问题的答案。要批评或要求作者澄清,请在其帖子下方留言。 - [来自评论](/ review/low-quality-posts/10482320) – swidmann

+1

@swidmann这确实提供了一个问题的答案。通过阅读[文档](https://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.textmaskformat%28v=vs.110%29.aspx)可轻松解答的小问题。往往可能会有轻微的寻找答案。 – GSerg