A: 

I apologize for the C# (I don't know the Vb syntax)

are you doing something like this:

  ChildForm child = new ChildForm();
  try {
      child.Show();
  }
  catch(Exception ex)
  {.....}

If so, I believe the Load event would happen on the New, not the Show(); (Show would fire Activate)

James Curran
When I step through in the debugger, the Load event happens on the Show().
NYSystemsAnalyst
A: 

The new window has its own thread, which is doing its own loading. To verify this, you can try putting in a Thread.Sleep for a few seconds into Form2_Load before the exception. Your main thread window should continue execution before you hit the exception.

Yuliy
Understandable, buy why does the code work differently in Visual Studio than when run outside of VS?
NYSystemsAnalyst
Hmmm... I missed that it was calling ShowDialog instead of Show, so it should block. That's a bit more puzzling then :-(
Yuliy
When I run the program outside of VS, use the Attach to Process... tool, and open the Threads and Call Stack window, I observe that the Form2_Load event is running on the Main thread and that the call stack shows Form1_ButtonClick calling Form2_Load. Yet, the behavior persists.
NYSystemsAnalyst
See nobugz's and mgilman's comments, as they seem to be on the right track here.
Yuliy
+1  A: 

I have the same problem. What I eventually did was to catch all exceptions. In C#:

Application.ThreadException += new ThreadExceptionEventHandler(MyHandler);

And then show the form.

I'd love to hear if anyone has a better solution.

Mitchell Gilman
+5  A: 

The Form.Load event behaves the same way as most other events in Windows Forms. It is dispatched by the message loop, in this case when Windows sends the WM_SHOWWINDOW message. There is an exception handler in the message loop that prevents an uncaught exception from terminating the message loop. That exception handler raises the Application.ThreadEvent event. The default event handler displays the unhandled exception dialog.

Long story short, you cannot catch an exception raised in the Load event in your button Click handler. Other than catching and handling exceptions in the Load event handler itself, very hard to do right, I'd recommend you add a public method to the form. Something like Initialize(). Move the code from your Load event into that method. Call Initialize() after calling the Show() method, exceptions are now yours to catch.

Hans Passant
+1 Thanks! Too bad there's only one crappy workaround... More code = more bugs ;-)
Vincent Van Den Berghe