CRDBGrid formatting floats
-
StoneWeasel
CRDBGrid formatting floats
Hi there, i was just wondering if anyone new of a way of formating floats in the CRDBGrid componant so that they can be forced to show 2 decimal places. I have a price column in a grid you see and the client wants the prices to look like prices, i have tried to work this out but to no avail. anyone know how i can do this?
-
StoneWeasel
Thankyou for your incredably quick response, i should have mentioned in my previous post that i have looked at the FloatFormat, FloatDigits and FloatPrecision properties of the column and set them accordingly but this does not seem to affect the numbers displayed in the cells, i did notice in the help that this only affects the value shown in the status bar.
Am I doing something wrong or theoreticly should simply setting up these properties display the floats in the format i want?
Thank you kindly for your help.
Am I doing something wrong or theoreticly should simply setting up these properties display the floats in the format i want?
Thank you kindly for your help.
Sorry for misunderstanding your post, actually settings for data values formatting placed in the field object, so you can access them by fields editor at design-time or with the next code at run-time:
For more information see TFloatField Delphi help topic.
Code: Select all
if OraQuery1.FieldByName('NUM') is TFloatField then
(OraQuery1.FieldByName('NUM') as TFloatField).DisplayFormat := '0.##'Formating float fields
Thank you very much, i've been looking exactliy for this. Works great now!