2015-12-08 102 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