ComponentOne True DBGrid for WinForms
Custom Number Formatting
Data Presentation Techniques > Text Formatting > Numeric Field Formatting > Custom Number Formatting

You can customize the display of numeric information by setting the NumberFormat property to a custom value rather than to a predefined option.

For example to set a numeric column to specifically display with three decimal points, set the NumberFormat property using the following code:

To write code in Visual Basic

Visual Basic
Copy Code
Me.C1TrueDBGrid1.Columns("Value").NumberFormat = "0.000"

To write code in C#

C#
Copy Code
this.c1TrueDBGrid1.Columns["Value"].NumberFormat = "0.000";

To set a date column to specifically display in the mm/dd/yyyy format, set the NumberFormat property using the following code:

To write code in Visual Basic

Visual Basic
Copy Code
Me.C1TrueDBGrid1.Columns("BirthDate").NumberFormat = "MM/dd/yyyy"

To write code in C#

C#
Copy Code
this.c1TrueDBGrid1.Columns["BirthDate"].NumberFormat = "MM/dd/yyyy";
See Also