Main Form hidden after Password form OK

  • Thread starter Thread starter Neville Lang
  • Start date Start date
N

Neville Lang

Hi all,

Although my problem is similar to a few previous posts on this list, none of
the answers seemed to work for me.

I have a Main Form which the Application.Run() starts up as the entry point.
During the constructor part of the main form, I make a call to a method that
displays a set of 3 registration screens. When the various details are
entered by the user and are all verified as OK, my code then completes the
constructor of the main form.

What happens is this: Instead of the main form displaying, the File Explorer
screen displays, the place where the app was started. I found that I needed
to click on the app icon again to get the main form to display. This is not
what I want to happen.

I have tried to move the registration checking to either side of the
InitializeComponent() in the main form's constructor but still the same
result. I have also moved my registration code to be called after the first
control gets focus, but still I cannot get the main form to display its
controls after the details entered are validated.

Any ideas anyone?


Regards,
Neville Lang
 
Neville,

Move the showing of your dialogs from the form's
constructor to a Load event handler. After returning from
your initial forms, your main form will be displayed. If
you only need the dialogs initially, you might need some
logic to ensure that you invoke them only once.

Regards,
Maarten Struys
PTS Software
 
Maarten,

I moved my registration code into Form_Load() event it and now works
perfectly. Unfortunately, I did not know about the Load event till just now.
To date, I have been doing all my pre-work for a form in the constructor. At
least now I have learned about the Load() event as well as an option. Thanks
again.

Regards,
Neville Lang
 
Chris,

Thanks for your reply. Maarten's suggestion of using the form's Load event
worked so I did not try your suggestion. I appreciate your reply though.

Regards,
Neville Lang
 
Back
Top