About input masks
You can use the Input Mask property to set the input mask of a form component.
You can select from these options or define your own.
- -#######
Mask characters
This table shows the list of characters you can use as part of an input mask:
Character | Description |
---|---|
> | Use as a numeric digit
placeholder (0-9). The prompt character is blank. |
9 | Use as a numeric
digit placeholder (0-9). The prompt character is 0. Masks with this character do not support Null values. See Usage Notes). |
Z | Use as a numeric
digit placeholder (0-9). The prompt character is blank, and the thousands separator is not applied. |
< | Use as a numeric
digit placeholder for decimal positions (0-9). The prompt character is blank. This character removes non-meaningful trailing zeros. |
# | Use as a numeric
digit placeholder (0-9). The prompt character is blank. Note: This character is available only for backward
compatibility and generally is not used.
|
- | Use as a negative
sign (–) placeholder. Use only for numeric data types. |
. | Use as a decimal
placeholder. This character is treated as a literal value in the mask. Use only for numeric data types. The actual character used is the one specified in your regional settings. See Usage Notes). |
, | Indicates the use of
a thousands separator. This character is treated as a literal in the mask. Use only for numeric data types. The actual character used as the separator is the one specified in your regional settings. This character is not necessarily the character actually used. |
: | Indicates the use of
a time separator. This character is treated as a literal in the mask. Use for DATE data types. The actual character used as the separator is the one specified in your regional settings. This character is not necessarily the character actually used. |
A | Use as an
alphanumeric character placeholder (0-9 and a-Z). Use for CHAR data types. |
? | Use as an alphabetic
placeholder (a-Z). Use for CHAR data types. |
X | Use as an alphabetic
placeholder that forces characters to be capitalized (A-Z). Use for CHAR data types. |
x | Use as an alphabetic
placeholder that forces characters to be lowercase letters (a-z). Use for CHAR data types. |
& | Use as a character
placeholder. Valid values for this placeholder are ANSI characters in the ranges 32-126 and 128-255. Use for CHAR data types. |
\ | Use as a literal
escape. To treat any of the preceding characters as literals, use a backslash before the character. |
[NONE] | Do not apply a mask. |
Usage notes
When you create an input mask, keep these ideas in mind:
Setting | Notes |
---|---|
Null | A numeric mask that contains 9 does not support
Null values. If this character is used in a mask, you must pass
some value for it to the component. The mask queries Null as
0 . Deleting or backspacing the value in a component produces
0 . Pasting from the clipboard produces 0 . If a
component with the mask is not required and has no default, the component value in a
new row initially shows 0 and can be saved as 0 if
no value is entered. A numeric mask that does not contain
|
[NONE] | This setting removes any mask inherited from a component class, a property class extension, or other object in the inheritance hierarchy. |
Thousands separators | Mask definitions do not have to specify thousands separators, for example, commas. These separators are set up automatically using the decimal symbol and digit-grouping symbol definitions in the Windows Control Panel Regional Options dialog box. |
Currency | The classes that represent currency data in the system use as defaults the values in the Windows Control Panel Regional Options dialog box specified for numbers, not the values specified for currency. |
Rounding | If the Round property is True, the application rounds according to the mask definition of decimal places. |
Suppressing Trailing Zeros | For decimal values that include the < character in the mask, the value displays with non-meaningful trailing zeros removed. |
Example
If the mask is set to >>>>>9.99<<< and the user enters 12345.125000, the value displays as 12,345.125. This formatting takes place after the cursor leaves the field.