Used to prompt users for input using a fixed format specified by a mask pattern, for example, a telephone number in a specified format. If a mask pattern is not used, this control behaves about the same as a standard text box.
Note: Non-Common Control properties are prefaced with "msk", suppressed in the following for greater legibility.
Properties
In addition to the properties listed below, a Control tab provides access to certain frequently used form properties for this control. See the Form Properties topic for information on those properties.
|
|
Masked Edit box |
|
General |
|
|
AutoTab |
Whether or not the next control in the tab order receives the focus as soon as the Text property of the Masked Edit box is filled with valid data. False (Default) - AutoTab is not on. A ValidationError event occurs if more characters are entered than allowed by the input mask. True - AutoTab is on and the focus moves immediately to the next control, which then receives any extra characters entered. |
|
PromptInclude |
Whether the Text property contains the prompt character. True (Default) - Text contains prompt characters, if any. False - Text property does not contain prompt characters. |
|
HideSelection |
True or False. True means that highlighted text will not appear highlighted when the masked edit box loses the focus. False means that highlighted text stays highlighted even when another form or dialog has the focus. |
|
Enabled |
True or False. True means the object can respond to user-generated events, false prevents it from responding. |
|
AllowPrompt |
Determines if prompt character is a valid input character. False (Default) - Prompt character is not a valid input character. True - Prompt character is a valid input. |
|
Mask |
Enter literal characters to be used as a mask, or choose from presets in the Format box. |
|
Format |
Choose from a set of predefined formats to specify how the data in the MaskedEdit box displays and prints. Can be different than the input mask (weird!). |
|
MousePointer |
The type of mouse pointer displayed when over the masked edit box. Choose from 16 different types plus a custom pointer |
|
BorderStyle |
FixedSingle (default) or None. None may be used with Flat Appearance to achieve an uncaptioned rectangle of background color. |
|
ClipMode |
Whether or not literal characters are included when doing a cut or copy command. True will limit copy operations to only data entered by the user, without literals. |
|
OLEDragMode |
DragManual (default) or DragAutomatic. DragManual means the program handles all OLE drag/drop operations, while DragAutomatic means the masked edit box handles all OLE drag/drop operations |
|
OLEDropMode |
Set to None (default) if the masked edit box does not accept OLE drops and is to display the No Drop cursor if an OLE drop is attempted. Set to Manual, the masked edit box will trigger OLE drop events, allowing programs to handle the OLE drop operation in code. |
|
MaxLength |
From 1 to 64. A mask field can have up to 64 characters. |
|
PromptChar |
The character to use for prompting users, almost always an underscore character. |
|
|
|
|
Color |
|
|
Back Color |
Color to be used for the masked edit box's background. |
|
Fore Color |
Color to be used for the masked edit box's foreground, the color of the text caption. |
|
Color Set |
Choose from Standard Colors (standard Windows non-dithered colors) or Windows System Colors. The latter will be defined by the user's Control Panel settings and is normally the setting used so that the form changes appearance like the rest of Windows if the Control Panel settings are changed. |
|
Color Palette |
Displays available colors. Click on the property to be changed to highlight it in the Properties pane, click on the desired color in the Color Palette pane and then press Apply. |
|
Edit Custom Color |
Change the custom color presented in the Color Palette when the Color Set is set to Windows System Colors. |
|
|
|
|
Font |
|
|
Properties |
Font properties that may be changes. |
|
Font |
Choose a font installed on this system. It's wise to choose standard Windows fonts such as MS Sans Serif that are universally available. |
|
Size |
Size of font, in points. |
|
Effects |
Bold, Italic, Underline or Strikeout. |
|
Sample Text |
A preview of the selected settings. |
|
|
|
|
Picture |
|
|
MouseIcon |
Custom icon to use when the MousePointer property is set to 99. Like Visual Basic, will not load animated cursor (.ani) files. |
Masks
Each character position in the input mask maps to a placeholder of a specified type or to a literal character. For example, a (###) mask has two literal characters () surrounding three digit placeholder characters, the #. As the user enters data the insertion point will automatically skip over literals to the next placeholder position indicated by the prompt character.
|
Mask Characters |
Description |
|
|
|
|
# |
Digit placeholder. |
|
. |
Decimal placeholder. Actual character shown will be substituted (. or ,) based on international settings. |
|
, |
Thousands placeholder. Actual character shown will be substituted (. or ,) based on international settings. |
|
: |
Time separator. Actual character shown will be substituted based on international settings. |
|
/ |
Date separator. Actual character shown will be substituted based on international settings. |
|
\ |
Treat next character as a literal. Allows use of placeholder characters as literals. Treated as a literal for masking purposes. |
|
& |
Character placeholder. ANSI characters from 32-126 and from 128-255. |
|
> |
Convert all characters that follow to uppercase. |
|
< |
Convert all characters that follow to lowercase. |
|
A |
Required alphanumeric character placeholder. |
|
a |
Optional alphanumeric character placeholder. |
|
9 |
Optional digit character placeholder. |
|
C |
Optional character or space placeholder. |
|
? |
Letter placeholder. |
|
[Literal] |
All other characters are displayed as themselves as literals. |
Format Property
The Format property modifies how the MaskedEdit control displays and prints using standard formats for numbers, currency and date/time data.
|
Format Value |
Description |
|
|
|
|
(Empty) |
Default numeric format. Displays as entered. |
|
$#,##0.00;($#,##0.00) |
Currency format using thousands separator with negative numbers in parentheses. |
|
0 |
Fixed number format displaying at least one digit. |
|
#,##0 |
Commas format using commas as thousands separator. |
|
0% |
Percent format. Multiply Value by 100 and append a percent sign. |
|
0.00E+00 |
Scientific notation. |
|
c |
Default general date and time format. Display date, time or both. |
|
dddddd |
Long date format taken from International setting of Control Panel. |
|
dd-mmm-yy |
Medium date format. |
|
ddddd |
Short date format taken from International setting of Control Panel. |
|
ttttt |
Long time format taken from International setting of Control Panel. |
|
hh:mm A.M./P.M. |
Medium time format. |
|
hh:mm |
Short time format. |
Tips
The MaskedEdit control is a bound control, so it can be linked to a data control and thus display field values for the current record in a data set. It can also write values to a data set. Use the three bound properties of MaskedEdit to do this: DataChanged, DataField and DataSource. See your favorite reference on the ADO Data Control for more info on such uses.