Convert.ToInt32 (Int64) converts 64-bit signed integer to 32-bit signed integer.
Module Example
Public Sub Main()
Dim numbers() As Long = { Int64.MinValue, -1, 0, 121, 340, Int64.MaxValue }
Dim result As Integer
For Each number As Long In numbers
Try
result = Convert.ToInt32(number)
Console.WriteLine(result)
Catch e As OverflowException
Console.WriteLine("OverflowException")
End Try
Next
End Sub
End Module
Related examples in the same category