Pieter van Wyk
Pieter van Wyk

Reputation: 2378

Delphi DBGrid Format Display Values

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

Upvotes: 3

Views: 16729

Answers (2)

Eduardo Mauro
Eduardo Mauro

Reputation: 1515

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.

Upvotes: 5

RRUZ
RRUZ

Reputation: 136391

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

check this sample

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

Upvotes: 6

Related Questions