LocationMy.Application.UnhandledException SyntaxPublic Sub Me_UnhandledException(ByVal sender As Object, _ ByVal e As UnhandledExceptionEventArgs) _ Handles Me.UnhandledException End Sub
DescriptionThe UnhandledException event occurs when an exception occurs in your application that is not handled by any other exception handle. Normally, when an exception occurs, it is handled by the surrounding try...Catch statement or by the On Error handler in effect for the procedure. If such handlers do not exist, the exception moves up the call stack, checking for active event handlers at each procedure in the stack. If there are no active event handlers in any of those procedures, the UnhandledException event is ultimately called. Public MembersThe e argument to this event, as an instance of the UnhandledExceptionEventArgs class, includes the following notable public members.
Usage at a Glance
ExampleThe UnhandledException event's code appears in the ApplicationEvents.vb file in a Windows Forms application. Namespace My Class MyApplication Private Sub MyApplication_UnhandledException( _ ByVal sender As Object, ByVal e As _ Microsoft.VisualBasic.ApplicationServices. _ UnhandledExceptionEventArgs) _ Handles Me.UnhandledException MsgBox("I can't handle it!") e.ExitApplication = True End Sub End Class End Namespace Related Framework Entries
See AlsoApplication Object, Shutdown Event, Startup Event, StartupNextInstance Event |