Mask edit box (maskedit)

Source: Internet
Author: User
The mask edit box (maskedit) is a special edit box. It can be used to design many complicated input formats. After selecting maskedit, You need to design an input format for it. The method is as follows:

First, select maskedit on the form, find the editmask attribute in the object Viewer (Object inspector), and double-click it to bring up a dialog box as shown in.

The input mask edit box in the upper-left corner of the dialog box is used to enter the mask format. The mask format can be divided into three parts. Each part is separated by a semicolon (;), for example, "!". 90: 90: 90:; 1 ;_". The following explains the meaning of each input format OPERATOR:

1. The first part of the input format is the mask itself, that is, the data input format. In this section, some special format characters are used to indicate the character types and formats to be entered, such as "! L0a9: C> ll <. Common maskedit input format characters include:

Format character Meaning
L and l L indicates that the location may be only one letter. You can skip it with the mouse key, but not other types of characters. L This position must be a character.
A and A indicates that the location can only be a letter or number. A indicates that the location must be a letter or digit.
C and C C indicates that the location may be only one letter, and C indicates that the location must have one letter.
9 and 0 9 indicates that the position can only be a number, and 0 indicates that the position must have a number.
    
And 〉 <Format character indicates that subsequent letters are displayed in lowercase until a> Format character or <> Format character is displayed.> The format is the opposite of <.
<> 〈〉 It indicates that case-insensitive conversion is not performed. The format of the input prevails.
\ The mask format character after the format operator will be treated as a common character in the data. When you want to add a mask format character to the data, you should put a \ symbol before the format character. For example, \.
# This position may be a number or positive symbol.
! If yes! The space before the data is not saved in the data. No! The space after the data is not saved .! The format character can only be placed at the first character of the mask format character.
; And/ A standard delimiter that can be used as part of data. Where/is displayed as '-' rather /.
    

2. In the second part of the input format, there are only two options: 0 and 1. If the value is 1, the non-user input data, standard separators, and other characters in the mask are saved as part of the data. If the value is 0, the data is not saved.

3. The third part of the input format is used to represent the space in the data.

With the above knowledge, Let's design an example. For example, enter a license plate number such as a CA-300019. The first two digits of the data are uppercase letters, the third digit is a system separator, And the last six digits are digits. You can design the mask format as follows:

!> Ll/000000; 1 ;_

The second part of the mask is 1, indicating that the system separator '-' will also be saved as data. The "_" in the third part indicates that when the mask editing box is empty, "_" is used to indicate the vacancy. We can also use spaces to identify vacant spaces.

Another example is a zip code such as a PO-100083, where Po represents the zip code, is a prefix in each zip code, you can design the mask format as follows:

! Po/000000; 1 ;_

On the right side of the Mask Design dialog box is sample masks, which has common preset mask formats, such as phone number and date. We can select one and make necessary adjustments. The lower left part of the dialog box is a test input column, where we can enter characters to check whether the input format is satisfactory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.