Convert.ToInt32 (String) converts string to an equivalent 32-bit signed integer.
Module Example
Public Sub Main()
Dim values() As String = { "One", "1.34e28", "-26.87", "-18", "-6.00", _
" 0", "137", "1601.9", Int32.MaxValue.ToString() }
Dim result As Integer
For Each value As String In values
Try
result = Convert.ToInt32(value)
Console.WriteLine(result)
Catch e As Exception
Console.WriteLine("Exception")
End Try
Next
End Sub
End Module
Related examples in the same category