Imports System
Public Class Overflow
Public Shared Sub Main(ByVal args As String())
Dim x As Integer = Integer.MaxValue
Try
Dim result As Integer = x + 1
Console.WriteLine("No Overflow!")
Catch ex As OverflowException
Console.WriteLine("Overflow Exception caught: " & ex.Message)
End Try
End Sub
End Class
' run:
'
' Overflow Exception caught: Arithmetic operation resulted in an overflow.
'