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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Currency - Property Inspector 1

Status
Not open for further replies.

Dave1024

Programmer
Oct 28, 2011
6
GB
Hi -

How can you format a currency field and specify the format of the nunber in property inspector WITHOUT entering explicit currency format symbols such as "£" ?

I am using RAD studio XE2. I know there is a "Currency" which is a yes/no type property in the property inspector - but the problem is - just setting this does not take care of the numeric formatting I require.

If I set the "Currency" property to true, I get the correct currency symbol being shown (taken from regional settings on the users system). However, the number of digits is wrong. For example, in the case of say £21.50, you get £21.5.

If I set the DisplayFormat value to pad out the number with zeros (as you would expect for currency) I loose the currency symbol!

Is there a way to flag the field as being currency AND specifying how many digits to show ?

I guess I could do this from code, but this would slow the whole thing down.

Any help would be much appreciated.

Cheers,.,

Dave.
 
Hi -

Thanks for the reply, however - I was wanting a solution that did not involve using code (as this will impact performance.)

I was hoping for a way to set the properties in the object inspector at design time.
 
Hi,

Set Currency property to true, and try adding the code below in the OnCreate event of the Main Form:

Code:
CurrencyDecimals := 2;

I hope it's useful.


Imoveis em Guarulhos
 
Hi -

Ok thanks, will give that a try.

Cheers..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top