The System.Windows.Forms.MaskedTextBox class has a property called Mask that represents the input mask for the text box. This mask is clearly specific to a culture. This entry discusses this property, its associated property editor and the localized masks provider by this property editor.
Click on the MaskedTextBox.Mask property in the Properties Window in Visual Studio and then click on the ellipses in the property and you will most likely see the following Input Mask dialog:-
The dialog represents a collection of example masks for the CurrentCulture ("English (United States)" in this example). The dialog itself is dependant upon the current culture and therefore it is determined by the setting in the Regional and Language Options dialog. You can, for example, see the Spanish examples by closing Visual Studio, setting the culture to Spanish (Spain), restarting Visual Studio and opening the dialog again:-
The number of examples is specific to the culture so if you open the dialog for German (Germany) you will see just 4 entries:-
Unfortunately this list is hard coded and there is no way to extend or customize the list. The examples are hard coded in the internal MaskDescriptorTemplate class. The possible values are shown here:-
en-US Descriptions | English / Invariant | Arabic | German | French | Italian | Spanish | Japanese | Chinese Simplified | Chinese Traditional | Korean |
Numeric (5-digits) | 00000 | n/a | n/a | 99999 | 99999 | 99999 | 99999 | 99999 | n/a | 99999 |
Phone Number | (999)000-0000 | (999)000-0000 | n/a | 00 00 00 00 00 00 | 0000 00000 | (999)000-0000 | 99900-9990-0000 | (900)9000-0000 | (00)9000-0000 | (999)9000-0000 |
Phone Number no Area Code | 000-0000 | 000-0000 | n/a | n/a | n/a | n/a | n/a | 9000-0000 | n/a | 9000-0000 |
Short Date | 00 /00 /0000 | 00 /00 /0000 | 00/00/0000 | 00/00/0000 | 00/00/0000 | 00/00/0000 | 0000/00/00 | 0000-00-00 | 0000/00/00 | 0000-00-00 |
Short date and time (US) | 00 /00 /0000 00:00 | 00 /00 /0000 00:00 | 00/00/0000 00:00 | 00/00/0000 00:00 | 00/00/0000 00:00 | 00/00/0000 00:00 | 0000/00/00 00:00:00 | 0000-00-00 90:00:00 | 0000/00/00 00:00:00 | 0000-00-00 90:00 |
Social Security Number | 000-00-0000 | 000-00-0000 | n/a | 0 00 00 00 000 000 00 | n/a | 000-00-0000 | n/a | n/a | n/a | 000000-0000000 |
Time (US) | 90:00 | 90:00 | 90:00 | 00:00 | 00:00 | 00:00 | 90:00 | 90:00 | 90:00 | 90:00 |
Time (European/Military) | 00:00 | 00:00 | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a |
Zip Code | 00000-9999 | n/a | 00000 | 00000 | 00000 | 00000 | 000-0000 | 000000 | 99000 | 000-000 |
Italian, Spanish, Japanese, Chinese (Simplified and Traditional) and Korean have additional formats for cell phone numbers. Japanese has additional date/time formats for the Japanese calendar. Chinese (Simplified and Traditional) has additional date/time formats and identity card formats. Korean has additional date/time formats.
The English formats are used for Engl
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5