Mask Settings in Windows Forms MaskedTextBox (MaskedEditBox)

This section deals with the mask settings of MaskedEditBox control.

The format or behavior for the MaskedEditBox control is defined through the property given below.

MaskedEditBox Property Description
Mask Specifies the mask string for the MaskedEditBox control.

The Mask is a string that is composed of literal characters and mask characters.

Literal characters give visual cues about the type of data being used. Mask characters are the placeholders for the data input. For example, a US telephone number can be represented by the following mask.

(###) - ### #### Extent ####

In the above Mask, all the non # characters are Literal characters and the #’s are Mask characters.

The MaskedEditBox control supports the following masks.

Mask Characters Description
# Digit placeholder.
. Decimal placeholder. The actual character used is the one specified as the decimal placeholder in your international settings. This character is treated as a literal for masking purposes.
, Thousands separator. The actual character used is the one specified as the thousands separator in your international settings. This character is treated as a literal for masking purposes.
: Time separator. The actual character used is the one specified as the time separator in your international settings. This character is treated as a literal for masking purposes.
/ Date separator. The actual character used is the one specified as the date separator in your international settings. This character is treated as a literal for masking purposes.
\ Treat the next character in the mask string as a literal. This allows you to include the "#", "&", "A", and "?" characters in the mask. This character is treated as a literal for masking purposes.
; Character placeholder. Valid values for this placeholder are ANSI characters in the following ranges: 32-126 and 128-255.
> Convert all the characters that follow to uppercase.
< Convert all the characters that follow to lowercase.
A Alphanumeric character placeholder (entry required). For example: a - z, A - Z, or 0 - 9.
a Alphanumeric character placeholder (entry optional).
9 Digit placeholder (entry optional). For example: 0 - 9.
C Character or space placeholder (entry optional). This operates exactly like the "&" placeholder and ensures compatibility with Microsoft Access.
? Letter placeholder. For example: a - z or A - Z.
Literal All other symbols are displayed as literals; that is, as themselves.
this.maskedEditBox1.Mask = "##-##-####";
Me.maskedEditBox1.Mask = "##-##-####"

Set the mask value to WF MaskedEditBox