A newer version of this page is available. Switch to the current version.

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.


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