How to get text from Masked Text Box without the masked format

Posted by Anuraj on Monday, June 2, 2014 Reading time :1 minute

.Net .Net 3.0 / 3.5 .Net 4.0 Windows Forms

Today I saw some SO question asked about how to get values from Masked Textbox without the masked format. For those who don’t know what is masked textbox - Uses a mask to distinguish between proper and improper user input.

Masked Textbox - With Phone Number mask property

Here is the code snippet.

//Make sure user completed the entry.
if (txtPhone.MaskFull)
    txtPhone.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
    txtPhone.TextMaskFormat = MaskFormat.IncludePromptAndLiterals;

Happy Coding :)

What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.

Similar Posts

Did you like this article? Share it with your friends

Facebook Twitter Google+ LinkedIn Reddit StumbleUpon

BMC logoBuy me a coffee

Copyright © 2019 - Anuraj P. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Hosted with ❤ by GitHub