wyrd Posted May 10, 2003 Posted May 10, 2003 Question.. Why does this.Close() exit and dispose the main application form, yet on newly created forms (Form frm = new Form();) the Close() method doesn't automatically dispose the form, only hides it? Quote Gamer extraordinaire. Programmer wannabe.
*Gurus* divil Posted May 10, 2003 *Gurus* Posted May 10, 2003 The way .NET Windows Forms apps are initially set up, the program's message loop depends on the first form shown. Therefore, when it is closed there's no way the program can remain running any UI elements. Application.Run() when called without any parameters sets up the message loop so it doesn't rely on any one form being open, but it does have the side effect that you have to terminate your message loop manually using Application.Exit() when all forms have been closed. 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
wyrd Posted May 11, 2003 Author Posted May 11, 2003 Hmm. I'll have to ponder that, I think I understand though. Quote Gamer extraordinaire. Programmer wannabe.
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.