Skip to main content

How to: Format a Numeric Value according to its Sign

The following example shows how to provide different formats for positive and negative numeric values and the zero value in a CalcEdit editor.

The result is demonstrated in the image below.

FormatDisplayAndEditValues_customFormat

using DevExpress.Utils;
// ...
calcEdit1.Properties.DisplayFormat.FormatType = FormatType.Numeric;
calcEdit1.Properties.DisplayFormat.FormatString = "#.00;[#.0];Zero";