Reputation: 853
I know there is masked textbox component for C#, but what I need is to create masked text box which requires entered text in format: LLL/LLL but when I enter such mask into Mask property in preview and mask I see separator "." but not "/" as I want to have. Any help? Thanks
Upvotes: 1
Views: 9513
Reputation: 11
Thanks for this clue there is one more problem in maskedtextbox that is when the system short date changes the mask also changes for example..
Before
System date : d/M/yy
Mask Format : __/__/__
After
System date : d-M-yy
Mask Format : __-__-__
Using escape char hepled me.
Just add escape char in mask. For example:
textbox1.Mask = 00/\00/\00
Upvotes: 1
Reputation: 941307
The / character is the date separator character in the mask. What you'll actually get depends on your culture preferences. To get a literal /
you'll have to escape it with a \
. Like this:
this.maskedTextBox1.Mask = @"LLL\/LLL";
Don't use the @ when you use the Properties window.
Upvotes: 4