FlexGrid for WinForms Task-Based Help > Formatting Cells > Formatting a Cell with Decimal Content |
To format a cell that contains decimal numbers, set the Format property either in the designer or in code. In this example, numbers already entered in the first column will be formatted to a decimal amount.
Alternatively, the Format property can also be set using the C1FlexGrid Column Editor:
Add the following code to the Form_Load event:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1FlexGrid1.Cols(1).Format = "$#,##0.00" |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1FlexGrid1.Cols[1].Format = "$#,##0.00"; |
Note: The format specifier follows the standard .NET conventions. Use ',' for thousand separators and '.' for the decimal, regardless of locale. |
In this example, the numbers in the first column are converted to a dollar amount.