Another new feature you''''ll want to take advantage of is a new set of Application-level events available in a partial class named MyApplication. Look for a file named MyEvents.vb under the My Project item in Solution Explorer. You can also find this file behind the View Code button on the Application tab in the application designer.
These new Application-level events are similar to the application events in the global.asax file in an ASP.NET application. Five events are exposed: • Shutdown • Startup • StartupNextInstance • NetworkAvailabilityChanged • UnhandledException
The first three events are fired as the application starts up and shuts down. NetworkAvailabilityChanged fires when the network state changes on the machine. Put code in the UnhandledException event in case an exception is thrown that you don''''t handle anywhere else.