Self Taught not sure how to add decimals

Ryker Wells

Member
Joined
Feb 9, 2012
Messages
16
Location
Fort Kent, ME
Programming Experience
1-3
So I am working this Decimal:

VB.NET:
Dim PriceofDVD As Decimal = 1.0

every so often i add

VB.NET:
 PriceofDVD += CInt((Amtbuyrice_nud.Value) * (0.03 * Overall))

so if it were 1 * 0.03 * 1 it comes out as += 0.03 but the price just stays at $1.00 and doesn't go to $1.03 also say it were 17 * 0.03 * 1 its 0.51 and when that happens it changes the price to $2.00 when i want it to be $1.51.

But I don't want VB to round for me I want it to add decimals instead of just adding 0 when the number is too low.

How would this be achieved?

Remember I'm Very new to this and like simple words and nice explanations :) thanks!

I got it! using
VB.NET:
Cint
makes it round to the nearest whole spot. For example

VB.NET:
bad:
Pricerice_txtbx.Text = Cint(Priceofrice)
good:
Pricerice_txtbx.Text = Priceofrice


(using VB 2010 express)
 
Last edited:
Back
Top