Gets or sets the input mask to use at run time.


object.Mask [ = "String" ]

Property Value

A String representing the current mask. The default value is the empty string which dis-allows any input.

Mask must be a string composed of one or more of the masking elements, as shown in the following table:

Masking Element Description
0 Digit, required. This element will accept any single digit between 0 and 9.
9 Digit or space, optional.
L Letter, required. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z] in regular expressions.
[abc...] Match set. Restricts input to the characters contained in the set.
[a-z...] Match range. Restricts input to the characters contained in the range.
\ Escape. Escapes a mask character, turning it into a literal. "\\" is the escape sequence for a backslash.
All other characters Literals. All non-mask elements will appear as themselves within MaskedTextBox. Literals always occupy a static position in the mask at run time, and cannot be moved or deleted by the user.


If you change a mask when MaskedTextBox already contains user input filtered by a previous mask, MaskedTextBox will attempt to migrate that input into the new mask definition.

See Also:

Applies To: MaskedTextBox

The CHM file was converted to HTML by chm2web software.