Skip to content

SetMask Method

Description

Applies the specified Mask to a PropertyGridItem data field.

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 wanted to restrict only numeric values, but wanted to display the area code inside of parentheses '(' and ')' then 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 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

See Also

PropertyGridItemOption Object


See Also


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