Hello Andrew,
Actually, it's suggestion 1) that give the best clue, because the first
thing to run is the Form1 Constructor. Then the Application.Run is started,
beginning the message pump at this point, then the Form1.Load() is run.
Application.Run( new Form1() );
// Is equivalent to:
Form1 f1 = new Form1();
Application.Run( f1 );
// except this will hold a few extra bytes of memory.
When using
Application.Run( new Form1() );
the "new Form1()" is evaluated first, running the constructor and passing it
to the Application.Run as a parameter, and Run runs. It is after this that
the Load event is called. So, suggestion 1) and this way are really the
same thing, except suggestion 1) breaks it down the it's logical steps and
allows you to add intervening steps.
Chris R.
"Andrew Warren" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
Thanks Chris. I'd already coded a solution along the
lines of your first option but I couldn't understand why
Application.Exit() _didn't_! Your comment in suggestion
2 answers this to some extent but raises the question -
when does the message pump start processing exactly? From
your comments it's some time between exiting the
constructor and exiting form.Load().