troubleshooting Question

DBGrid column format currency

Avatar of DigitalNam
DigitalNamFlag for Namibia asked on
3 Comments1 Solution4517 ViewsLast Modified:
Hi all,

I have tried everything and searched everywhere but I must be overlooking something. I have a DBgrid that is linked to a query. One of the columns needs to show currency and the field is float. I am using Delphi XE.

I have tried the following but Delphi XE doesn't have the displayformat property.

dbgrid1.colums[NumberOfColum].field.displaymask := '#,##0.00';

//variante 1
procedure TForm1.Button1Click(Sender: TObject);
  TNumericField(dbgrid1.Columns[0].Field).DisplayFormat := '#,##0.00';

//variante 2
procedure TForm1.Button2Click(Sender: TObject);
  TNumericField(dbgrid1.DataSource.Dataset.FieldbyName('FloatFieldName')).DisplayFormat := '#,##0.00';

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros