Public Class MyException
Inherits System.Exception
Sub New(ByVal Message As String)
MyBase.New(Message)
End Sub
End Class
Public Class Tester
Public Shared Sub Main
Try
Console.WriteLine("About to generate custom exception")
Throw (New MyException("** Custom Message **"))
Catch Ex As MyException
Console.WriteLine("Custom Exception thrown " & Ex.Message)
End Try
End Sub
End Class
|