bortolano Posted July 25, 2003 Posted July 25, 2003 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. Quote
*Gurus* divil Posted July 25, 2003 *Gurus* Posted July 25, 2003 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
bortolano Posted July 25, 2003 Author Posted July 25, 2003 Thanks for the help. With every new version of VB, I get a little dumber, hehe :) Quote
joeybagadonutz Posted January 28, 2004 Posted January 28, 2004 If you hide the form instead of closing it, then will the program still be running it on a users machine after they install it? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.