property Editor.Mask as String
Retrieves or sets a value that indicates the mask used by the editor.

   String A string expression that defines the editor's mask.  

Use the Mask property to filter characters during data input. Use the Numeric property to filter for numbers.

Use the Mask property to control the entry of many types of formatted information such as telephone numbers, social security numbers, IP addresses, license keys etc.  The Mask property has effect for the following edit types: DropDownType, SpinType, DateType, MaskType, FontType, PickEditType. Use KeyDown and KeyUp event procedures if you need to respond to both the pressing and releasing of a key. Use the Editing property to check whether the control is running in the edit mode.

Use the MaskChar property to change the masking character.  If the Mask property is empty no filter is applied. The Mask property is composed by a combination of regular characters, literal escape characters, and masking characters. The Mask property can contain also alternative characters, or range rules. A literal escape character is preceded by a \ character, and it is used to display a character that is used in masking rules. Here's the list of all rules and masking characters:

Rule Name Description
# Digit Masks a digit character. [0-9]
x Hexa Lower Masks a lower hexa character. [0-9],[a-f]
X Hexa Upper Masks a upper hexa character. [0-9],[A-F]
A AlphaNumeric Masks a letter or a digit. [0-9], [a-z], [A-Z]
? Alphabetic Masks a letter. [a-z],[A-Z]
< Alphabetic Lower Masks a lower letter. [a-z]
> Alphabetic Upper Masks an upper letter. [A-Z]
* Any Mask any combination of characters.
\ Literal Escape Displays any masking characters. The following combinations are valid: \#,\x,\X,\A,\?,\<,\>,\\,\{,\[
{nMin,nMax} Range Masks a number in a range. The nMin and nMax values should be numbers. For instance the mask {0,255} will mask any number between 0 and 255.
[...] Alternative Masks any characters that are contaied by brackets []. For instance, the [abcA-C] mask any character: a,b,c,A,B,C

The following sample adds an editor for masking phone numbers:

With XMLGrid1
        With .Editors.Add("Phone", MaskType)
            .Mask = "(###) - ### ####"
        End With
        With .Nodes
            With .Add("Phone", "")
                .Editor = "Phone"
            End With
        End With
End With

Send comments on this topic.
1999-2015 Exontrol.COM, Software. All rights reserved.