Friday, April 8, 2011

Masked TextBox, how to include the promptchar to value?

How to include the prompt char on masked textbox's Text? I also want to save the prompt char

Example i specify mask: &&&&/&&

And prompt char of _

Then I enter 12 4/5. the program should save it as 12_4/5. Anything left blank should be converted to prompt char when getting the masked Textbox's Text

[EDIT]

Found it, set TaskMaskFormat to IncludePromptAndLiterals

From stackoverflow
  • You could create a derived class from the MaskedTextBox and then override the Text property. On setting you would find/replace the prompt char with a space and when getting replace the space with the prompt char.

0 comments:

Post a Comment