ComponentOne True DBGrid Pro 8
EditMask Property

EditMask Property

Input mask string for a column.

Syntax

column.EditMask  = string

Remarks

Read/Write at run time and design time.

The EditMask property is used to specify an input mask template for end-user data entry. You can construct your own input mask string using template characters similar to those recognized by the Visual Basic Format$ function. The input mask string is composed of special characters that represent either an input character that the user must enter, or a literal character that will be skipped over on input. Valid template characters are as follows:

#

Digit placeholder

@

Character placeholder

All characters following will be in uppercase

All characters following will be in lowercase

~

Turns off the previous "<" or ">"

?

Digit or character

\

Next character is treated as a literal

&

Any character

Any other character will be treated as a literal.

After the user finishes editing a cell with this input mask, True DBGrid caches the modified cell text, but any literal characters in the input mask template will be stripped from the modified cell text beforehand.

The EditMask property also supports a built-in DateMask option for formatting date fields. When the DateMask option is selected (by setting the property "Date Mask"), the following input mask template will be used for editing:

mm/dd/yyyy

mm

Month placeholder (01-12)

dd

Date placeholder (01-31)

yyyy

Year placeholder

The user can enter either 1, 2, 3, or 4 digits in the year portion of the date, and the grid will save the year as entered by the user. If the user enters 1 or 2 digits for the year portion, the grid will make no interpretation for the year; that is, the grid will not assume whether it is the century 1900 or 2000, but will store the 1-digit or 2-digit year as entered. Before the date is updated to the database, you can interpret the year yourself in code, or let the underlying database system handle the interpretation and storage.

Note that if you select the DateMask option for the EditMask property, the date separators are part of the date format; they are not considered as literal characters and will always be cached by the grid. This is because most databases and formatters require the separator characters to be present in order to interpret the date correctly.

See Also

Column Object

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback