Results 1 to 4 of 4

Thread: I'm closing window, but it's not killing process

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    I'm closing window, but it's not killing process

    I have this program that I made. It's not doing any multi-threaded stuff or creating any new process, or opening any new windows. After I start the program and click on the button that does some loops, when I click the "x" on the top right corner to close the window, I noticed in the task manager that the process is still running. When I run it at debug mode, I do the same thing and it is still going through the loop. Any idea why it's doing this? I've always thought closing the main window stops the process.

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: I'm closing window, but it's not killing process

    Try adding this line inside your loop.
    Code:
    Application.DoEvents();

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

    Re: I'm closing window, but it's not killing process

    Because your loop will run to completion unless you tell it to stop. Should the process simply stop without knowing where in the loop it's up to and whether doing so could damage your data or the system? If you want to exit without completing the loop then you need to place inside the loop to do so.
    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

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: I'm closing window, but it's not killing process

    I never knew that. Thanks.

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