This problem can be avoided by providing escape character before '/'.
e.x. maskedTextBox1.Mask = @"00\/00\/0000 00:00 AA";
This will force the system to show '/' on the screen.
MaskedTextBox.Mask not working properly
-
12-12-2021 - |
Domanda
I am using MaskedTextBox
in my code to for a date field.
When I am giving maskedTextBox1.Mask = "00/00/0000 00:00 AA"
in code,on running the application in my machine it works fine and mask in the textbox
appears as [_ _/_ _ _/____ __:__ _ _ _]
But when i am running the same application in another machine, the mask appears as [_ _ _-_ _ _-____ __:__ _ _ _]
How is the /
replaced by -
? Is the mask machine dependent, if yes how can we avoid this problem?
Soluzione 2
Altri suggerimenti
I think it has more to do with application culture http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask.aspx
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow