Rich Newman

Top-level Exception Handling – Code Listing 3

        static void Main()
         {
             Application.ThreadException += new ThreadExceptionEventHandler(new ThreadExceptionHandler().ApplicationThreadException);
             try
             {
                 SplashScreen splash = new SplashScreen();
                 splash.Show();
                 DoLongRunningSetUpStuff();
                 splash.Close();
             }
             catch (Exception e)
             {
                 // You probably want something a little more sophisticated than this
                 MessageBox.Show(e.Message, "An exception occurred:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 System.Environment.Exit(0);
             }
  
             Application.Run(new MainForm());
         }
  

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.