Emil Dumbazu Emil Dumbazu - 10 days ago 6
Vb.net Question

Round an integer number in VB.NET

How could I round an integer number based on the last digit of the number?

For example:

Dim x As Integer = 12
Dim y As Integer = 139
Dim z As Integer = 2322


The result should be:

x = 20
y = 140
z = 2330

Answer

Use:

Math.Ceiling(value / 10) * 10

reference: http://msdn.microsoft.com/en-us/library/zx4t0t48.aspx#Y0

Comments