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

System.String.Format("{0:C}" question

Status
Not open for further replies.

lin73

Programmer
Joined
Feb 17, 2006
Messages
110
Location
SE
Hi

I currently use this line ...

CartTotal.Text = "Total: " & System.String.Format("{0:C}", TotalNumber).ToString


to display the total sum of a shoppingcart, but it allways round up/down to nearest number. How can I change this so it display like this... 123,48


Regards

 
This is how I set it in one of my forms that calculates tax.

Dim Total As Decimal
Total = Label.Text

Label.Text = CDec(Label.Text).ToString("C")

 
I think that the reason it is rounding is because of your variable type for "TotalNumber" .. try converting it to a Decimal or a Double then converting to currency format.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top