|  | 
| .Format Currency | 
| Post Reply   | 
| Author | |
| mar72vin   Groupie   Joined: 20 September 2008 Status: Offline Points: 18 |  Post Options  Thanks(0)  Quote  Reply  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# | |
|  | |
| Aaron   Senior Member   Joined: 29 January 2008 Status: Offline Points: 2192 |  Post Options  Thanks(0)  Quote  Reply  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.... | |
|  | |
| mar72vin   Groupie   Joined: 20 September 2008 Status: Offline Points: 18 |  Post Options  Thanks(0)  Quote  Reply  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# | |
|  | |
| CapoPezzio   Groupie   Joined: 13 April 2010 Status: Offline Points: 25 |  Post Options  Thanks(0)  Quote  Reply  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 | |
|  | |
| Baldur   Senior Member   Joined: 22 November 2006 Location: Germany Status: Offline Points: 244 |  Post Options  Thanks(0)  Quote  Reply  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" | |
|  | |
| Post Reply   | |
| Tweet | 
| Forum Jump | Forum Permissions  You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |