OverflowException Class
Imports System
Imports Microsoft.VisualBasic
Module MainClass
Sub Main( )
Dim value As Integer = 780000000
Try
' Square the original value.
Dim square As Integer = value * value
Console.WriteLine("{0} ^ 3 = {1}", value, square)
Catch e As OverflowException
Dim square As Double = Math.Pow(value, 2)
Console.WriteLine("Exception: {0} > {1:E}.", _
square, Int32.MaxValue)
End Try
End Sub
End Module
Related examples in the same category