Question

I am using a DBGrid component in Delphi. I wonder how I can set the format of a column. I have real values that I want to be displayed as currency in the grid.

Someone knows how?

Was it helpful?

Solution

  1. You can set the DisplayFormat of the Field
  2. You can handle OnGetText event. This approach allows to do more complex operations with the value.

OTHER TIPS

If you don't add the fields to field Editor list you can get the formating by code as :

TFloatField(MyQuery.fieldByName('MyField').DisplayFormat := '0.00';

if you don't want to show the zeros replace '0.00' with '#.##';

The first port of call is the DisplayFormat of the data field in the database itself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top