Use CInt to convert long to Integer
Imports System.Globalization
Module Example
Public Sub Main()
Dim lNumber As Long = 9999999999
Try
Dim number1 As Integer = CInt(lNumber)
Console.WriteLine(number1)
Catch e As OverflowException
Console.WriteLine("{0} is out of range of an Int32.", lNumber)
End Try
End Sub
End Module
Related examples in the same category