Computer Science Canada Currency Formatting Problem.... |
Author: | BioHazardousWaste [ Sun May 16, 2004 2:03 pm ] |
Post subject: | Currency Formatting Problem.... |
Hey guys, i've been working with VB for a while now; nothing serious such as API, registry etc. but i've done quite a bit of other stuff. However, I keep running into the same problem, and it is really starting to piss me off. When working with prices, I cannot get it to format correctly. E.X. I want to display $9.20 in the text box TxtFinalPrice... First I do some calculations Pen $1.00 Pencil $1.00 Floppy Disk $4.00 Ruler $2.00 blah blah, add em up u get $8.00, i'll assign that to Price Price = 8 Then we have to calculate tax (I live in Ontario - 15%) TotalPrice = Price * 1.15 and we get 9.2... so then I add a dollar sign TotalPrice = "$" & TotalPrice BUT HOW THE HELL DO I GET IT TO ADD THE 0 TO THE END? I've tried formatting the variable as currency, textbox as currency, rounding.. nothin works.. can somebody please give me a hand? |
Author: | Brightguy [ Mon May 17, 2004 4:13 pm ] |
Post subject: | Re: Currency Formatting Problem.... |
txtFinalPrice.Text = Format(TotalPrice, "Currency") or txtFinalPrice.Text = FormatCurrency(TotalPrice) TotalPrice should be a numeric variable. There's no need to add a "$" sign if you format it like this. |