PDA

Click to See Complete Forum and Search --> : I'm closing window, but it's not killing process


benmartin101
Dec 26th, 2006, 06:26 PM
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.

wild_bill
Dec 26th, 2006, 10:04 PM
Try adding this line inside your loop.
Application.DoEvents();

jmcilhinney
Dec 26th, 2006, 10:09 PM
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.

benmartin101
Dec 27th, 2006, 10:51 AM
I never knew that. Thanks.