Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToInt64 (String) converts string to 64-bit signed integer

Module Example    Public Sub Main()         Dim values() As String = { "One", "1.34e28", "137", "11111.9", Int32.MaxValue.ToString() }         Dim result As Long                  For Each value As String In values            Try               result = Convert.ToInt64(value)               Console.WriteLine(result)            Catch e As Exception               Console.WriteLine("The {0} value '{1}' is not in a recognizable format.", _                                 value.GetType().Name, value)            End Try            Next                                     End Sub End Module