Link to home
Start Free TrialLog in
Avatar of NevSoFly
NevSoFly

asked on

Is there a way to stop vb.net from rounding?

I have a variable in a calculation with a decimal value of 0.222222222222 the format limits this to 4 decimal places so the result should be 0.2222 but the result ends up being 0.  Is there a way to make it display correctly (stop rounding)?
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Can you show us some code?
CInt (0.222222222222 * 10000) / 10000
ASKER CERTIFIED SOLUTION
Avatar of 13Shadow
13Shadow

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NevSoFly
NevSoFly

ASKER

As It turns out one of the values was being converted into an integer as 13Shadow suggested I am going to use James' code snippet for now.