Jessee
asked on
VB.Net Stop ineger rounding
Hey,
How do I stop an integer from rounding?
I have numbers set out as #.##, but it always rounds to just 1 number.
How do I stop this?
Thanks!
How do I stop an integer from rounding?
I have numbers set out as #.##, but it always rounds to just 1 number.
How do I stop this?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
which value did u tried and was rounded to 1?
ASKER
Private HomepageFeature As Integer = 39
You can't stop and Integer from rounding. An integer by definition is a whole (i.e. non-decimal) number. You need to change data type to a floating-point type if you want decimals.
39 is an integer type so how exactly it was rounded to 1?!?!?
i don't understand where the issue comes from, can u explain with code?
i don't understand where the issue comes from, can u explain with code?
You can take look at this article: http://vbnotebookfor.net/2007/07/31/what-you-should-know-about-rounding-in-vbnet/
However, I have to agree with the other comments. If you are using an Integer data type you will not have any floating point value. You will need to choose a data type that supports floating points such as Decimal, Float, Double. etc.
However, I have to agree with the other comments. If you are using an Integer data type you will not have any floating point value. You will need to choose a data type that supports floating points such as Decimal, Float, Double. etc.
ASKER
Have decided to go with using a string. I misunderstood what an integer was.
Sedgwick, the part of code I was referring to was = 1. I copied the =39 by mistake. Sorry for the confusion.
Sedgwick, the part of code I was referring to was = 1. I copied the =39 by mistake. Sorry for the confusion.