Results 1 to 2 of 2

Thread: [2005] closing application

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    127

    [2005] closing application

    I have 2 forms in the application. The first form lets user select what information the second form will display.

    When the user close the second form, is the first form also closed? I noticed that the process is still in the task manager. Is there a way to completely close the application?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] closing application

    There are two options in the project properties. You can either quit the app after closing the first form or after closing all forms. With the first option the app will exit if and only if you close the first form. That means that you must keep the first form open until you want to exit the app. With the second option the app will exit if and only if there are no more forms open. This is good for a dialogue-based application like a wizard because you can close the first form when you show the next without exiting the app.

    Depending on which option you choose you can call the Close method of either the first or the last form to exit the app. Regardless of which option you choose you can call Application.Exit at any time and from anywhere.

    Now, having said all that, it sounds like your design is flawed. It sounds like you're hiding the first form then closing the second, so you can't see any forms but the first is still open so the app won't exit. In that case you should be choosing the second option and closing the first form instead of hiding it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width