Gambas Documentation - /comp/gb.form/maskbox/mask

/comp/gb.form/maskbox/mask

# MaskBox.Mask (gb.form)

Property Mask As String

Return or set the control mask.

The mask is a string that depicts how characters are validated. If the mask is void, then the MaskBox acts like a normal TextBox.

Mask item | Function | Default character | Description
--- | --- | --- | ---
`[...]` | Character range | Space | Every character in the range is allowed. The syntax of the character range is the same as in the LIKE instruction.
`?` | Any character | Space | Any character is allowed.
`0` | Mandatory digit | Zero | Any digit is allowed.
`#` or `9` | Optional digit | Space | Any digit is allowed.
`A` | Letter | Space | Any ASCII letter is allowed.
`<` | Right-aligned field | N/A | The characters between the last separator and the `<` character will be right-aligned.
`!` | Focus | N/A | Define where is the default character position of the control when it gets the focus.
Other characters | Separator | N/A | Any other character is a separator that will be displayed as is on the screen.
`\` | Quoting | N/A | If you want to use a special character as a separator, you have to quote it with the `\` quoting character.

### Examples

Mask | Meaning
--- | ---
`$#,###,##0<!.##` | Currency.
`##0<.##0<.##0<.##0<` | IPv4 address.
`99/99/9999` | Some date.
`A[A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_]` | A four character identifier.