Delphi DBGrid Format Display Values

后端 未结 2 683
眼角桃花
眼角桃花 2021-01-20 14:55

I need to format values in a DBGrid to display in a certain format ex \'#,##0.00\'. Any idea how to do that?

Regards, Pieter

相关标签:
2条回答
  • 2021-01-20 15:08

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

    check this sample

    TFloatField(YourDataSet.FieldByName('field')).DisplayFormat := '#,##0.00';
    
    0 讨论(0)
  • 2021-01-20 15:21

    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 讨论(0)
提交回复
热议问题