Board index » delphi » Formatting a DBGrid Column

Formatting a DBGrid Column

I am trying to show a numeric with two spaces of decimal in a grid.
The problem is that when my grid shows, 4.20 shows as 4.2, 5.00 shows
as 5 so my column is sloppy in appearance.  Any suggestions on how to
fix this.

Any help is greatly appreciated.

Thanx in advance.
Rick Lowery
( remove the *nospam* to reply )

 

Re:Formatting a DBGrid Column


Hei Rick,

Do the following test to check that the column is a TNumericField by;

    if (MyGrid.Columns[Indx-1].Field is TNumericField) then
      TNumericField(MyGrid.Columns[Indx-1].Field).DisplayFormat := '0.00';

-Harald

Rick Lowery <rlowery@*nospam*streetware.com> wrote in article
<3439a027.16980...@news.atl.mindspring.com>...

Quote
> I am trying to show a numeric with two spaces of decimal in a grid.
> The problem is that when my grid shows, 4.20 shows as 4.2, 5.00 shows
> as 5 so my column is sloppy in appearance.  Any suggestions on how to
> fix this.

> Any help is greatly appreciated.

> Thanx in advance.
> Rick Lowery
> ( remove the *nospam* to reply )

Re:Formatting a DBGrid Column


First, I'm sorry my english.
See the DisplayFormat property of TField.
--
Saludos de Adolfo.
barra...@ahvm.hvm.sas.cica.es

Rick Lowery <rlowery@*nospam*streetware.com> escribi en artculo
<3439a027.16980...@news.atl.mindspring.com>...

Quote
> I am trying to show a numeric with two spaces of decimal in a grid.
> The problem is that when my grid shows, 4.20 shows as 4.2, 5.00 shows
> as 5 so my column is sloppy in appearance.  Any suggestions on how to
> fix this.

> Any help is greatly appreciated.

> Thanx in advance.
> Rick Lowery
> ( remove the *nospam* to reply )

Other Threads