How to get raw text from MaskedTextBox?

后端 未结 3 1631
滥情空心
滥情空心 2021-01-19 03:38

I have a MaskedTextBox with this mask (999) 999 9999. When user inputs a number the text property would give this to me :

(0881) 444 5445

B

相关标签:
3条回答
  • 2021-01-19 04:02

    It's Work for me

    Just Change Property Value

    0 讨论(0)
  • 2021-01-19 04:04

    Try setting the maskedTextBox.TextMaskFormat property to MaskFormat.ExcludePromptAndLiterals

    0 讨论(0)
  • 2021-01-19 04:14

    Based on what I found here you can set the TextMaskFormat-Property to MaskFormat.ExcludePromptAndLiterals. That should be you solution.

    The MaskFormat-Enumeration holds some "options" for the MaskedTextBox.
    They are:

    1. ExcludePromptAndLiterals Return only text input by the user.
    2. IncludeLiterals Return text input by the user as well as any literal characters defined in the mask.
    3. IncludePrompt Return text input by the user as well as any instances of the prompt character.
    4. IncludePromptAndLiterals Return text input by the user as well as any literal characters defined in the mask and any instances of the prompt character.

    The default is IncludeLiterals

    0 讨论(0)
提交回复
热议问题