Convert decimal to Integer
Class Sample
Public Shared Sub Main()
Dim values() As Decimal = { Decimal.MinValue, 199.55d, 2010.16d, Decimal.MaxValue }
Dim result As Integer
For Each value As Decimal In values
Try
result = Convert.ToInt32(value)
Console.WriteLine(result)
Catch e As OverflowException
Console.WriteLine("{0} is outside the range of the Int32 type.", _
value)
End Try
Next
End Sub
End Class
Related examples in the same category