FlexGrid for WinForms | ComponentOne
C1.Win.C1FlexGrid Namespace / C1FlexGridBase Class / EditMask Property

In This Topic
    EditMask Property (C1FlexGridBase)
    In This Topic
    Gets or sets the input mask to use when editing cells.
    Public Property EditMask As String
    public string EditMask {get; set;}

    The EditMask specifies an input mask for automatic input formatting and validation. The mask syntax is similar to the one used by the Microsoft MaskedEdit ActiveX control and by Microsoft Access and is described below.

    Set the EditMask property in response to the BeforeEdit event, in the same way you would set the ComboList property.

    If the same mask is used to edit all values in a column, use the column's RowCol.EditMask property. This simplifies your code because you don't need to handle the BeforeEdit event.

    When the user is done editing a cell with a mask, the ValidateEdit event fires. The event parameter will be set to true if the mask was not filled out properly, so in most cases you don't have to implement the handler. The default behavior ensures that only valid data will be entered.

    The EditMask string is composed of the following symbols:

    1) Wildcards

    0 digit

    9 digit or space

    # digit, space, 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

    4) Placeholder specification

    ; next character is used as a placeholder (the default is an underscore)

    The code below sets the edit mask so the user can enter a phone number, with optional area code, and a state in uppercase letters. The space-holder used is an asterisk ("*").
    flex.EditMask = "(###) 000-0000 St\ate\: >LL;*";
    See Also