Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

decimals after . exmpl 0.2 must read .20

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I've got a problem

I use a dbase database in the database desktop I can see the number for example

2.00

but in delphi edits and grids it rounds it off to

2

or 2.30 becomes 2.3

I use delphi 3 can someone help? PLEASE!

email me a qobcc@yahoo.com


thanx
hennie
 
In order for this to be achieved you can select the Field against the Dataset (TTable or TQuery component) and make use of the DisplayFormat property against the field.
Set the property to be something like '0.00' (2 decimal places) or '0.000' (3 decimal places).
When you display the field in data aware components (DBEdit or DBGrid for example) the field entry should be formatted as required.
Steve
 
Thanx, could you please post me sample code so that I can see where to use it.

Thanx again
 
Right Click your TTable or TQuery component and select 'Field Editor' from the pop up menu. Right click the list (if empty) and select 'Add All Fields' - this should then create the Field list for the TTable/TQuery component. In this list, highlight a field and hit F11 for the Field's object inspector. Select the 'DisplayFormat' property and entry '0.000' (without the single quotes).
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top