Re: Format numbers for Delphi grid display

Posted by DelphiLand Team on October 20, 2004

In Reply to: Display numbers in grid problem posted by Robert on October 12, 2004 at 22:33:24:

: I'm using a TStringGrid to display numeric data of a matrix from a textfile. There's a problem when passing the numeric values, using FloatToStr to show them in the grid, it is that all the zeros that are
: after the decimal comma are not shown in the grid.
[ ... ]

Try the following Delphi conversion / formatting function, instead of FloatToStr() :

StringToShow := FormatFloat('0.0000000', N);

In the example above, '0.0000000' means: show 7 digits after the decimal separator'.

With N=7.512 this would give:

[ DelphiLand FAQ ]