|
-
Apr 30th, 2009, 11:16 PM
#6
Re: Help with very basic coding
You do know that your "total" variable will not hold any decimal numbers? Meaning if you add a hamburger that is 1.50 to it, then the total will read 2 because Integers don't hold decimals so they automatically round.
Instead, make all of your number variables Decimals, then when you want to output the total, use:
Code:
total.ToString("C2")
And it will display in US Currency mode. Also, I suggest you turn Option Strict On to avoid conversion errors.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|