开发者

Delphi DBGrid Format Display Values

开发者 https://www.devze.com 2023-01-13 20:35 出处:网络
I need to format values in a DBGrid to display in a certain format ex \'#,##0.00\'. Any idea how to do tha开发者_运维知识库t?

I need to format values in a DBGrid to display in a certain format ex '#,##0.00'. Any idea how to do tha开发者_运维知识库t?

Regards, Pieter


you can use the DisplayFormat property of the field to format.

check this sample

TFloatField(YourDataSet.FieldByName('field')).DisplayFormat := '#,##0.00';


Each Field in your DataSet has two events: OnGetText and OnSetText. Use event OnGetText of desired fields and use Format function to format the value using a mask.

0

精彩评论

暂无评论...
验证码 换一张
取 消