FlexGrid for WinForms
EditMask Property (C1FlexGridBase)
Example 



Gets or sets the input mask to use when editing cells.
Syntax
'Declaration
 
<C1DescriptionAttribute("Gets or sets the input mask to use when editing cells.")>
<BrowsableAttribute(False)>
<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)>
<EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="C1.Win.C1FlexGrid.Design.InputMaskEditor, C1.Win.C1FlexGrid.4.Design")>
Public Property EditMask As String
'Usage
 
Dim instance As C1FlexGridBase
Dim value As String
 
instance.EditMask = value
 
value = instance.EditMask
[C1Description("Gets or sets the input mask to use when editing cells.")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="C1.Win.C1FlexGrid.Design.InputMaskEditor, C1.Win.C1FlexGrid.4.Design")]
public string EditMask {get; set;}
[C1Description("Gets or sets the input mask to use when editing cells.")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="C1.Win.C1FlexGrid.Design.InputMaskEditor, C1.Win.C1FlexGrid.4.Design")]
public:
property String^ EditMask {
   String^ get();
   void set (    String^ value);
}
Remarks

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)

Example
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;*";
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

C1FlexGridBase Class
C1FlexGridBase Members

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Send Feedback