Recent

Author Topic: [SOLVED] DBGrid - How to Format Two Decimal Places to the Right  (Read 4570 times)

guest48180

  • Guest
In the SQLite3 db, the field holds entries of 286.53 and 225.50. When I call for the data and place these fields in DBGrid, I get 286.52999999999997 and 225.5. The field is of type REAL.

How can I force the DBGrid disp0lay to show 286.53 and 225.50 respectively?


denver

  • Jr. Member
  • **
  • Posts: 67
Re: DBGrid - How to Format Two Decimal Places to the Right
« Reply #1 on: August 13, 2018, 08:09:27 pm »

Try

i := 0  // The First Column
i := 1 // The Second Column

DBGrid1.Columns.Items[ i ].DisplayFormat := ' #.00' ;


guest48180

  • Guest
Re: DBGrid - How to Format Two Decimal Places to the Right
« Reply #2 on: August 13, 2018, 08:13:13 pm »
Works like a charm. Thanks, denver.

 

TinyPortal © 2005-2018