Board index » delphi » DBGrid Question

DBGrid Question

How do you define the display properties of a field?  I am displaying a
Foxpro DataBase in DBGrid, but when the column is poiting to a amount
that should be '10.00' it displays '10' and 3.30 displays as '3.3'.
Can someone help?  I want two numbers to the right of the decimal to
diplay.  It would be really nice, if I could define these colums as
currancy.
But right now I would like someone to tell me how to change the display
to display the 2 digits to the right of the decimal for these fields.

kev...@pcmtpa.com

 

Re:DBGrid Question


Use displayformat properties of tables field companent.
Ex : if field value is 3.3 and you used ##,##.00 the value seems  3.30.

Hope to help u

Kadir

Re:DBGrid Question


You need to set the DisplayFormat property of the TField object.  You can do
this at design time by instantiating the field objects in the Fields Editor,
selecting the field object, then setting the DisplayFormat in the Object
Inspector.

At run time you could do:

Table1.FieldByName('SomeField').DisplayFormat := '######.##';

--
Bill Todd
(Sorry but TeamB cannot answer questions received via email)
(Remove nospam from my email address to contact me for any other reason)

Re:DBGrid Question


Hi

In the DisplayFormat (or EditFormat) property of your  TField put the
following mask : #,##0.00
If you don't have the TFields yet, doubleclick your TTable(or Tquery)
component and with RightMouseButton click the Editor and choose AddFields.
After that the field will be available in the Object Inspector.
BestRegards,

--
Elio Medeiros
Rio de Janeiro - Brasil
e-mail <el...@hotmail.com>

Other Threads