Dodgeram01 Posted September 22, 2002 Posted September 22, 2002 Okay, practicing my coding skills (lol), I decided to make a little program that would figure the sales tax in with stuff. Anyways, I've come to the conclusion that it'd be a lot more accurate if it would round the total amount to the hundredths place. I believe it will be somethign with the math.round(number) deal, but I can't quite figure it out. Thanks. (the number is assigned to a string). Quote Dodge Grab Life By The Horns
*Experts* Bucky Posted September 22, 2002 *Experts* Posted September 22, 2002 You first need to convert the string into a number which you can work with, and then you can use the Round function to get it to a certain decimal place. Consider this example: Dim dNum As Double ' Number before rounding Dim dNumRounded As Double ' Number after rounding dNum = Double.Parse("14.52612") ' Turn the String into a Double dNumRounded = Math.Round(dNum, 2) ' Round it (the 2 is the # of decimal places to round) MessageBox.Show(dNumRounded.ToString) ' Shows the results (should be "14.53") HTH Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Dodgeram01 Posted September 22, 2002 Author Posted September 22, 2002 Just what I was hoping for! Thank You! Quote Dodge Grab Life By The Horns
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.