Mega Code Archive

 
Categories / VB.Net / Date Time
 

Parse String to Integer and catch OverflowException

Class Sample    Public Shared Sub Main()         Dim string1 As String = "2010"         Try            Dim number1 As Integer = Int32.Parse(string1)            Console.WriteLine(number1)         Catch e As Exception            Console.WriteLine("Exception")         End Try     End Sub  End Class