Print Page | Close Window

.Format Currency

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
Printed Date: 02 December 2022 at 2:21am
Software Version: Web Wiz Forums 12.04 -

Topic: .Format Currency
Posted By: mar72vin
Subject: .Format Currency
Date Posted: 11 October 2010 at 6:55pm
Hi Guys,
I am currently using (Item.Format = "$ %s") to format my data as currency. This is fine except that my data is stored in a decimal value and the report control shows 4 0's. i.e. "$ 100.0000".

What format can I use to only show 2 decimal places?

Product: Xtreme Report Control (ActiveX) version 15.1.3
Platform: Windows 7 (64bit)
Language: c#

Posted By: Aaron
Date Posted: 12 October 2010 at 4:25pm
Try this:

    .Format = "$ %.2f"


Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....

Posted By: mar72vin
Date Posted: 12 October 2010 at 5:34pm
Thanks Aaron! Unfortunately I already tried this and after reading the docs I realize why. Only the "%s" type is supported with the Format method.  This means that the Format method will only format strings and treats all numeric values as strings.

I am experimenting with converting my decimal to a string prior to adding it to the report with string.Format("{0:0.00}",_value).

I would prefer to be able to supply the decimal value to the report control and allow it to do the formatting.

Strangely I have also noticed that when a format is applied the groupformulas SUMSUB does not work. Does this mean that I need to supply values for both the .Value and .Caption of each item so that the groupFormulas are working on an un-formatted value. Is there a better way to do this?

Product: Xtreme Report Control (ActiveX) version 15.1.3
Platform: Windows 7 (64bit)
Language: c#

Posted By: CapoPezzio
Date Posted: 29 October 2010 at 6:14am
Hi mar72vin. I prefer to do the formatting on the Metrics in the BeforeDrawRow-event.

Metrics.Text =string.Format("{0:0.00}",_value).

Then I leave the .value and .caption "untouched" and the groupFormulas are working fine

Product: Xtreme SuitePro (ActiveX) version 13.3.1
Platform: Windows 7 (32bit)
Language: Visual Basic 6.0

Posted By: Baldur
Date Posted: 10 December 2010 at 3:56am
You should set the properties .Value for the unformatted value and the .Caption for the formatted value.
The .Format-Property excepts also VB-Formats like "$#,##0.00;$-#,##0.00"

Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 -
Copyright ©2001-2021 Web Wiz Ltd. -