I'm writing a program that requires the user to select a file when the program starts. If he cancel this the program exits.
Currently I'm creating an OpenFileDialog in the main form's constructor, but it's not working very well due to the following issues:
* If the user cancels I can't simply exit by closing the main form from the constructor. So I have to throw an exception that is handled in Main...ugly.
* If the user starts the program e.g. by double click on it in explorer the OpenFileDialog pops up. When the user has selected a file the main form is hidden behind the explorer window.
* I would like the main form to be visible and the OpenFileDialog on top of it instead of showing the main form after the OpenFileDialog has been closed.
I was looking for an event that would occur when the main form has been opened completely, but I can't find any.
Any advices...?