text: CF35: Setting the initial form at run-time
  I'm developing an .NET CF35 application that is to show either of two forms at startup, depending on wether or not the app is configured by the user. This has proven to be quite a headache for me. Program.cs launches one single form as the "master form" in the Application.Run()-call. When that master form closes, the application terminates. Due to this fact, I found it troublesome to have a dynamic master form (Approach A), because then the forms themsevles had to make sure they didn't close before all other forms were closed, or else the application would terminate. The solution I've tried to implement is based on another approach (B):
  Here a single, constant master form always initiates from Program.cs, performing Form_Load and then spawns the child form if the settings file is ok, finally calling Hide() on itself. The user will not see the initial form. But then another problem rises: Although the initial form is never shown, its MENU hangs at the bottom of the screen (MainMenu) even after the child form is shown. As soon as the user touches the screen, the menu is replaced by the menu of the child form though (but this is not good enough). I've done some debugging and have discovered that the initial form recieves several Activated events after the child form is created and initialized, and after the inital Form_Load and Form_Activated is called on the inital form.
  -Do anyone have any idea on why the first form receives many (I count 4) activated-events AFTER Hide() is called? There are no calls to the master form from the child form.
  -Is my approach sound? Are there better ways to acheive what I want?
  -Do anyone have a good source where I can read up on the event model for forms in the Compact Framework, as it seems to differ some from the Windows Forms?
  Why not modify the Program.cs to select which form to load?
  Marked as answer by ZHE ZHAO Tuesday, January 12, 2010 5:14 AM
  Wednesday, January 6, 2010 3:22 AM
  You may consider calling showdialog() instead of show() if you want to close the new form every time.
  I tried to create a new form under GotFocus Eventhandler of Form1, it seems to work for me.
  Friday, January 8, 2010 7:51 AM
  That's what I tried to explain with Approach A. I got problems because I used Close() and not Hide() when swapping between the two forms, as the application terminated at unwanted times. But I'll try the approach once more now as I have redesigned to use Hide() and keep references to the windows at all times. I'll post the results when I'm done.
  I'd still be interested in documentation on the Compact Framework Forms event model though.. I'm still puzzeled over all the Activated calls after Load.
  Wednesday, January 6, 2010 12:26 PM
  Yes ShowDialog might be solution also. I ended up coding a bit of login in Program.cs - performing a conditional Application.Run in a loop. It works, so now I won't be touching anything :)