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 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. Call the Refresh method to update the editor's mask.

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 VB sample adds an IP editor:

With Record1
     With .Add("IP", EXRECORDLibCtl.MaskType)
        .Mask = "{0,255}\.{0,255}\.{0,255}\.{0,255}"
        .Value = ""
    End With
End With

The following VC sample adds a Phone editor:

COleVariant vtMissing; vtMissing.vt = VT_ERROR;
CEditor editor = m_record.Add(COleVariant("Phone"), /*MaskType*/ 8, vtMissing );
editor.SetMask("(###) ### - ####");
editor.SetValue( COleVariant( "(0744) 845 - 2835" ) );

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