Problem with displaying currency in a Label,Caption

Hi All,
Using Delphi Community 10.4

I’m trying to get a currency value displayed in a Label.Caption

The problem I’m getting is its being displayed in scientific notation on a random basis regardless of how wide I make the caption. Ie sometimes its displayed correctly as Currency ($10,800.00 etc) other times its shown as 1.08E04
Screenshot currency problem.pdf (10.2 KB)

the code Im using is;

LabourPrice_Label.Caption := FloatToStrF(Total_Labour, ffCurrency, 4, 2);

I know its something Im doing but can some one show me what so I can resolve this rather annoying issue.

Many thanks in advance.
Grant Brown

Not sure why that function is randomly changing its output, however have you considered using

CurrToStr() (currency to String ) conversion function instead?

Hi Grant

Try increasing the number of digits in the result to a reasonable value.

For example I would start with

LabourPrice_Label.Caption := FloatToStrF(Total_Labour, ffCurrency, 15, 2);

and decrease the width until OK.



Hi Graeme,

That seems to have solved the problem

As always the simplest of things are the hardest to work out


Hi Grant,

Using the FormatCurr(const Format: string; Value: Currency) function allows you to format the result in the way you specifically want to have it appear.


John Van De Giessen

Hi Grant

I have never used that function. I normally use Format(‘%m’, [val]).