* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
2.8 KiB
title, ms.date, f1_keywords, helpviewer_keywords, ms.assetid
| title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||
|---|---|---|---|---|---|---|
| How to: Set the Input Mask | 03/30/2017 |
|
|
779b3a12-cd74-4e58-b46e-04983bda5b2c |
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 xref:System.Windows.Forms.MaskedTextBox class.
Setting the Mask Property Manually
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 xref:System.Windows.Forms.MaskedTextBox.Mask%2A property.
To set the Mask property manually
-
In Design view, select a xref:System.Windows.Forms.MaskedTextBox.
-
In the Properties window, locate the xref:System.Windows.Forms.MaskedTextBox.Mask%2A property.
-
Type the mask that you want. For example, type
###.
Using the Input Mask Dialog Box
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
-
In Design view, select a xref:System.Windows.Forms.MaskedTextBox.
-
Click the smart tag to open the MaskedTextBox Tasks panel.
-
Click Set Mask.
- or -
-
In the Properties window, select the xref:System.Windows.Forms.MaskedTextBox.Mask%2A property.
-
Click the ellipsis button in the property value column.
The Input Mask dialog box appears.
-
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.
Note
The Preview box displays the characters that the user sees in the xref:System.Windows.Forms.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 xref:System.Windows.Forms.MaskedTextBox.ValidatingType%2A property.
-
Click OK.
The mask is entered in the Mask property in the Properties window.