John Nuñez
John Nuñez

Reputation: 1830

Rounding up in VB.NET

How can I round 4.39 to 5 in VB.NET?

I tried:

Math.Round(4.39, 0)

But it displays 4.

Upvotes: 3

Views: 22703

Answers (1)

driis
driis

Reputation: 164281

Use Math.Ceiling in order to round a number to the closest, larger, integer value:

Math.Ceiling(4.39)

As explained in the MSDN link:

"Returns the smallest integral value that is greater than or equal to the specified double-precision floating-point number."

Upvotes: 15

Related Questions