Mega Code Archive

 
Categories / VB.Net Tutorial / Development
 

Throw custom exception

public class Test    public Shared Sub Main         Throw New MyException("Unhandled Error in MyMethod")             End Sub End class Public Class MyException     Inherits System.ApplicationException     Private m_Source As String     Public Sub New(ByVal Message As String)         MyBase.New(Message)         Me.m_Source = "ClassLibrary1"     End Sub End Class Unhandled Exception: MyException: Unhandled Error in MyMethod at Test.Main()