下面的示例展示了如何在显示数值的列中使用标准的格式说明符。 该列的格式字符串被设置为“c2”。 这指明把取值的格式设置为在小数点右侧有两位数字的货币金额。

下面的插图展示了代码运行结果:

要获得关于格式说明符的信息,请参阅 格式说明符 主题。

C#CopyCode image复制代码
colNumbers.Format.FormatType = DevExpress.Utils.FormatType.Numeric;
colNumbers.Format.FormatString = "c2";
Visual BasicCopyCode image复制代码
colNumbers.Format.FormatType = DevExpress.Utils.FormatType.Numeric
colNumbers.Format.FormatString = "c2"