Wednesday, March 05, 2008

How to set DBGrid Field Display Format

Source: http://coding.derkeiler.com/Archive/Delphi/borland.public.delphi.database.ado/2006-02/msg00057.html

How do we control the display format for the columns of a DBGrid. I would like currency fields to show as '0.00' format or just some other format?

Here is the solution:

The format is not a property of the DBGrid.Column but a property of the Field. So right click on your DataSet (or Query) and select Add Fields. Then select for the Float Field and specify Display Format someting like "#,##0.00" or some other format that you want it.


Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

0 Comments: