WinForms applications written in .NET 1.x and converted to .NET 2.0 that have a global unhandled exception handler need to be modified to trap the exception.
An example of the 1.x way to implement a global exception handler follows:
(in Sub Main):
AddHandler Application.ThreadException, AddressOf OnThreadException
The exception handler:
Public Sub OnThreadException(ByVal sender As Object, _
ByVal t As System.Threading.ThreadExceptionEventArgs)
LogError(t.Exception)
Application.Exit()
End Sub
In .NET 2.0, this code will not trap the exception. The .NET 2.0 framework requires hooking AppDomain.CurrentDomain.UnhandledException instead:
(in Sub Main):
AddHandler AppDomain.CurrentDomain.UnhandledException, _
AddressOf OnUnhandledException
The exception handler itself can be implemented as shown below:
Public Sub OnUnhandledException(ByVal sender As Object, _
ByVal t As UnhandledExceptionEventArgs)
Logger.LogError(t.ExceptionObject)
Application.Exit()
End Sub
 Latest Newsletter
 Latest Newsletter
	
		 Demos
 Demos
	
		 Microsoft Access Developer Help Center
 Microsoft Access Developer Help Center
	
		 Microsoft Access Query Help Center
 Microsoft Access Query Help Center
	
		 MS Access to SQL Server Upsizing
 MS Access to SQL Server Upsizing
	
		 Microsoft Outlook Tips
 Microsoft Outlook Tips
	
		 Technical Papers
 Technical Papers
	
		 Tips and Techniques
 Tips and Techniques
	
		 Videos
 Videos
Thank you! Thank you! I just finished reading this document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.
Darren D.
		
        	 All Our Microsoft Access Products
        
        All Our Microsoft Access Products