How to: Set the Input Mask
The masked text box control is an enhanced text box control that supports a declarative syntax for accepting or rejecting user input. By setting the Mask property, you can specify the allowable user input without writing any custom validation logic in your application. For more information, see the Remarks section of the MaskedTextBox class.
If you are familiar with the characters that the Mask property supports, you can enter it manually. For a summary of the characters that the Mask property supports, see the Remarks section of the Mask property.
To set the Mask property manually
The Input Mask dialog box provides some predefined input masks. You can also change the predefined masks or enter your own mask manually.
To open the Input Mask dialog box
To use the Input Mask dialog box
(Optional) Click one of the predefined masks in the list.
(Optional) Edit the predefined mask in the Mask box.
(Optional) Type a new mask in the Mask box. That is, you do not have to use one of the predefined masks.
The Preview box displays the characters that the user sees in the MaskedTextBox. These characters are a guide to help the user enter the data correctly.
Select or clear the Use ValidatingType check box. The Use ValidatingType check box specifies whether a data type is used to verify the data input by the user. For more information, see the ValidatingType property.
The mask is entered in the Mask property in the Properties window.