Domanda

Hello I have created maskedtextbox in my WinForms app with mask: 0/0 AAAAA and when I do install this on PC where Czech language is set as default it converts the backslash into dot so I have 0.0 AAAAA

May I ask if is there any way to avoid this automatic change?

Thank you for your time.

È stato utile?

Soluzione

The / character in the Mask property is the date separator. It is automatically localized, in Czech the . character is the date separator.

You'll need to escape the character to let it know that you meant the literal. Use 0\/0 AAAAA instead. Note that added backslash.

Altri suggerimenti

Try setting the Culture property of your MaskedTextBox to English culture (because you don't care about the local culture):

yourMaskedTextBox.Culture = new CultureInfo("en-US");
//or set it to an InvariantCulture
yourMaskedTextBox.Culture = CultureInfo.InvariantCulture;

You can change this behaviour thru the Control Panel configuration window "Region and Language" settings.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top