Try Catch Exception : Try Catch « Development « VB.Net Tutorial






Option Strict On
 Imports System

 Class Tester

     Shared Sub Main( )
         Console.WriteLine("Enter Func2...")
         Try
             Console.WriteLine("Entering Try block...")
             Throw New System.Exception( )
             Console.WriteLine("Exitintg Try block...")
         Catch
             Console.WriteLine("Exception caught and handled")
         End Try
        Console.WriteLine("Exit func2...")
     End Sub 'Main

 End Class 'Tester
Enter Func2...
Entering Try block...
Exception caught and handled
Exit func2...








7.5.Try Catch
7.5.1.Try Catch Exception
7.5.2.Catch Exception throwed from a Method
7.5.3.Catch specific Exception from a Method
7.5.4.Catch different Exception with multiple catch statements
7.5.5.Filtered Exception
7.5.6.Catch without Exception type
7.5.7.Catch custom exception