Mega Code Archive

 
Categories / VB.Net Tutorial / Development
 

Catch Exception throwed from a Method

Option Strict On  Imports System  Class Tester      Shared Sub Main( )          Console.WriteLine("Enter func1...")          Try              Console.WriteLine("Entering Try block...")              Func1( )              Console.WriteLine("Exiting Try block...")          Catch              Console.WriteLine("Exception caught and handled")          End Try          Console.WriteLine("Exit func1...")      End Sub      Public Shared Sub Func1( )          Console.WriteLine("Enter Func2...")          Throw New System.Exception( )          Console.WriteLine("Exit Func2...")      End Sub  End Class Enter func1... Entering Try block... Enter Func2... Exception caught and handled Exit func1...