Use CInt to convert long to Integer : Long « Data Types « VB.Net






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

1.Long and Single NumberLong and Single Number
2.Append long data type values to a StringBuilder object.
3.Get Long MinValue
4.Is Long value signed
5.Convert long value to string 16 based
6.Convert string value to UInt64
7.And two UInt64 values
8.Use the Sign(Long) method to determine the sign of a Long value and display it to the console.