Monday, April 11, 2005

Unhandled Exceptions for Whidbey Beta 1 Windows Programs

I have some XML files that I needed to process so I decided to write a Whidbey Windows forms program to display them. One of the first things I discovered is that when you create a windows forms project, in the project you get an folder named myproj. If you open this folder you will see a file myevents.vb among others.

Double-click to open this file in code view. You will see a class for the application. In this class you can add events that have application scope. One of the events that can be added is the unhandled exception event. Simply add code here to handle exceptions that are not handled within the application code itself. You could do this sort of thing using Visual Studio .NET but it was up to you to hook up the events etc. With Whidbey you just open this file, and place your exception handling code in the unhandled event.

Really a time saver!!

0 Comments:

Post a Comment

<< Home