Skip to main content

How to: Format Column Values Using Standard Format Strings

The following examples formats column values using standard format specifiers for date-time and numeric values.

The following image shows the result:

Format Cell Values - WinForms Data Grid, DevExpress

colOrderDate.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
colOrderDate.DisplayFormat.FormatString = "D";

colUnitPrice.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
colUnitPrice.DisplayFormat.FormatString = "c2";

colDiscount.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
colDiscount.DisplayFormat.FormatString = "P0";