ComponentOne True DBGrid for WinForms
Specifying an Input Mask for a Column
Cell Editing Techniques > Input Masking > Specifying an Input Mask for a Column

The EditMask property of the C1DataColumn object is used to specify an input mask template for end-user data entry. The input mask string is composed of special characters that represent either an input character that the user must enter or a literal character that will be skipped over on input. Valid template characters are as follows:

The EditMask must be a string composed of the following symbols:

  1. Wildcards

    0          digit

    9          digit or space

    #          digit or sign

    L          letter

    ?          letter or space

    A          letter or digit

    a          letter, digit, or space

    &          any character

  2. Localized characters

    .          localized decimal separator

    ,          localized thousand separator

    :          localized time separator

    /          localized date separator

  3. Command characters

    \          next character is taken as a literal

    >          translate letters to uppercase

    <          translate letters to lowercase

For example:

To write code in Visual Basic

Visual Basic
Copy Code
' Set the mask so the user can enter a phone number, with optional area code, and a state in capitals.
Me.C1TrueDBGrid1.Columns(0).EditMask = "(###) 000-0000 St\ate\: >LL"

To write code in C#

C#
Copy Code
// Set the mask so the user can enter a phone number, with optional area code, and a state in capitals.
this.c1TrueDBGrid1.Columns[0].EditMask = "(###) 000-0000 St\\ate\\: >LL";