official) implementation of exception handling, which uses object of class "Try". With New Try: On Error Resume Next 'Create new object of class "Try" and use it. Then set this object as default. Can be "Dim T As New Try: ... ... T.Catch 'do Something (only one statement recommended) .Catch: On Error GoTo 0: Select Case .Number 'Call Try.Catch() procedure. Then switch off error handling. Then use "switch-like" statement on result of Try.Number property (value of property Err.Number of build-in Err object) Case SOME_ERRORNUMBER 'exception handling Case Is <> 0 'When Err.Number is zero, no error has occurred 'unknown exception End Select: End With ' *** Try Class *** Private mstrDescription As String Private mlngHelpContext As Long Private mstrHelpFile As String Private mlngLastDllError As Long Private mlngNumber As Long Private mstrSource As String Public Sub Catch() mstrDescription = Err.Description mlngHelpContext = Err.HelpContext mstrHelpFile = Err.HelpFile mlngLastDllError = Err.LastDllError mlngNumber = Err.Number mstrSource = Err.Source End Sub Public Property Get Source() As String Source = mstrSource End Property Public Property Get Number() As Long Number = mlngNumber End Property Public Property Get LastDllError() As Long LastDllError = mlngLastDllError End Property Public Property Get HelpFile() As String HelpFile = mstrHelpFile End Property Public Property Get HelpContext() As Long HelpContext = mlngHelpContext End Property Public Property Get Description() As String Description = mstrDescription End Property Visual Basic .NET A Try block must have at least one clause Catch or Finally clause and at most one Finally clause. Try ' code to be executed here Catch ex As Exception When condition ' Handle Exception when a specific condition is true. The exception object is stored in "ex". Catch ex As ExceptionType ' Handle Exception of a specified type (i.e. DivideByZeroException, OverflowException, etc.) Catch ex As Exception ' Handle Exception (catch all exceptions of a type not previously specified) Catch ' Handles anything that might be thrown, including non-CLR exceptions. Finally ' Always run when leaving the try block (including catch clauses), regardless of whether any exceptions were thrown or whether they were handled. ' Often used to clean up and close resources such a file handles. ' May not be run when Environment.FailFast() is called and in other system-wide exceptional conditions (e.g. power loss), or when the process crashes due to an exception in another thread. End Try Visual Prolog try % Block to protect catch TraceId do % Code to execute in the