Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - .Format Currency
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

.Format Currency

 Post Reply Post Reply
Author
Message
mar72vin View Drop Down
Groupie
Groupie


Joined: 20 September 2008
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote mar72vin Quote  Post ReplyReply Direct Link To This Post Topic: .Format Currency
    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#
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 12 October 2010 at 4:25pm
Hi,
 
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....
Back to Top
mar72vin View Drop Down
Groupie
Groupie


Joined: 20 September 2008
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote mar72vin Quote  Post ReplyReply Direct Link To This Post 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#
Back to Top
CapoPezzio View Drop Down
Groupie
Groupie


Joined: 13 April 2010
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote CapoPezzio Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Baldur View Drop Down
Senior Member
Senior Member


Joined: 22 November 2006
Location: Germany
Status: Offline
Points: 244
Post Options Post Options   Thanks (0) Thanks(0)   Quote Baldur Quote  Post ReplyReply Direct Link To This Post 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"
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

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

This page was generated in 0.188 seconds.