Mega Code Archive

 
Categories / VB.Net Tutorial / Data Type
 

Convert a string into a 64-bit signed integer value using the Int64 Parse(String) method

Module MainClass    Public Sub Main()       Convert(" 1")    End Sub    Private Sub Convert(value As String)       Try          Dim number As Long = Int64.Parse(value)          Console.WriteLine("Converted '{0}' to {1}.", value, number)       Catch e As FormatException          Console.WriteLine("Unable to convert '{0}'.", value)       Catch e As OverflowException          Console.WriteLine("'{0}' is out of range.", value)             End Try    End Sub End Module