Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

This is probably a silly question, but I want to have a startup form that the user uses to login. Once authentication is complete, I want to close the form and open the main menu.

 

When I open the 2nd form and close the first, the program quits. If I use the Sub Main, the program quits. If I hide the first form and open the second, it works, but I would rather close the form when I'm done with it.

 

Is there a simple way to open one form, close the calling form, and have the program continue to run?

 

Thanks.

  • *Gurus*
Posted

This is because your message loop is based around the first form only. The cheap fix is to simply hide the first form instead of closing it.

 

The better way is to change to a startup Sub Main instead of a form. In that sub, show your first form and then run Application.Run(), which will start your message loop running. It will then be up to you to indicate when you are ready for your application to close by calling Application.Exit() manually.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...