I can't round up the decimal number using VB.net

i'm using Cint(12.5) this must be 13 but it is not
so i try Round(12.5) but still not roundup
what do i do?
please help!!!

Recommended Answers

Try

Math.Round(12.5)
Jump to Post

use this:

math.Round(12.5,0,MidpointRounding.AwayFromZero)
Jump to Post

All 5 Replies

i have tried math.round(12.5) but it didn't work. May be i have to write my own function??

use this:

math.Round(12.5,0,MidpointRounding.AwayFromZero)

i have tried math.round(12.5) but it didn't work. May be i have to write my own function??

Add .49999999 first then Int it! Assuming you want to round up to the nearest whole number.

commented: bad and unflexible solution. -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.