Wednesday, April 13, 2005

More Whidbey Windows Cool Features

When I teach .NET development classes I always try to talk about "quick hits" that can be used to make an application have richer functionality or a nicer UI.

In a Whidbey Windows Forms project, for “the add existing” item option, there are several forms that can be added, including an about form and a splash screen form. Both of these forms have a pleasing UI (which can be changed) and also include logic to display associated project information. For example, the about form has logic to populate information like the product name, version and copyright from the assembly. The splash screen has a nice UI and also fills in the version number, application name and copyright from the assembly. Of course you can always add change the UI and add your own information.

The cool thing is that there is a new project property (an application property) called splash screen where you can select a form in your project to be the splash screen. This form is displayed automatically when the project starts up. The only issue that I have seen with it is that it disappears rather quickly. I have not found a way to change the length of time that the designated splash screen will stay visible.

For the about form, you will have to display that yourself, perhaps as a menu item entry.

In any event, now when writing a windows forms project it is easy to add a splash screen and an about box with a minimum of effort.

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!!