How to: Format Cell Values

The following example shows how to format OrderDate field values and summaries corresponding to the Extended Price field. OrderDate field values are formatted using a long date pattern while Extended Price summaries are formatted as integer currency values.

Refer to the Standard Numeric Format Strings topic for detailed information about the standard numeric format specifiers.

The result of the code is shown below:


// Formats the OrderDate field's values using a long date pattern.
fieldOrderDate.ValueFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
fieldOrderDate.ValueFormat.FormatString = "D";

// Formats the ExtendedPrice field's values as integer currency values.
fieldExtendedPrice.CellFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
fieldExtendedPrice.CellFormat.FormatString = "c0";