Since it is common for the input and display formats to be the same, the NumberFormat property has an Edit Mask option (note the space between words). If this option is selected, then the EditMask property setting will be used for both data input and display. However, the input and display formats need not be the same, so you are free to select a NumberFormat option that differs from the EditMask property.
For example, the following code applies a phone number template to a column for both display and editing:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1TrueDBGrid1.Columns("Phone").EditMask = "(###) ###-####" Me.C1TrueDBGrid1.Columns("Phone").NumberFormat = "Edit Mask" |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1TrueDBGrid1.Columns["Phone"].EditMask = "(###) ###-####"; this.c1TrueDBGrid1.Columns["Phone"].NumberFormat = "Edit Mask"; |
For more information on how to specify a data input mask, see Input Masking.