Skip to content

SetMask Method

Description

Applies the specified Mask to data in the Text property.

Syntax

Public Sub SetMask( _
    ByVal [Mask](#) As String, _
    ByVal [Literal](#) As String, _
    Optional ByVal [Prompt](#) As Variant _
)

Parameters

Mask

You can use any of these characters for defining your edit mask:

  • 0 - Numeric (0-9)
  • 9 - Numeric (0-9) or space (' ')
  • # - Numeric (0-9) or space (' ') or ('+') or ('-')
  • L - Alpha (a-z)
  • ? - Alpha (a-z) or space (' ')
  • A - Alphanumeric (0-9 and a-z)
  • a - Alphanumeric (0-9 and a-z) or space (' ')
  • & - All printable characters only
  • H - Hex digit (0-9 and A-F)
  • X - Hex digit (0-9 and A-F) and space (' ')
  • > - Forces characters to upper case (A-Z)
  • < - Forces characters to lower case (a-z)

Any of these characters can be combined with additional characters to create a restrictive field for text entry. For example, if you wanted to display a prompt for a telephone number and restrict only numeric values while displaying the area code inside of parentheses '(' and ')', you could define your mask as:

Phone No: (000)000-0000

Literal

Literal defines the prompt area of the mask where text entry is allowed. This should match the areas that you have already defined as mask fields. By default, the prompt character is _.

Phone No: (___)___-____

Prompt

This value is optional, but allows you to define default characters that you want displayed when the user presses the backspace key. This usually represents data that has been previously saved and then restored. This makes it easy for the user to restore some or all of the default text displayed when the control was initialized. Again, this value should match the previously defined mask:

Phone No: (800)555-1212

Example

txtMaskedEdit.SetMask "Phone No: (000) 000-0000", "Phone No: (___) ___-____"

See Also


See Also | Suite Pro Controls ActiveX Control v24.0


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.