Module Demo1

  Sub main()

    Try

       Throw New OverflowException()

    Catch ex as Exception

        System.Console.Writeline(ex.message)

   End Try

  End Sub

End Module

You can also throw a custom exception as shown in the example below:

Module Demo2

  Sub Main()

     Try

         Throw New ApplicationException(“This is a new exception”)

      Catch ex as Exception

         System.Console.Writeline(ex.Message)

   End Try

  End Sub

End Module