VB.NET Application does not fully close
When I launch my appl开发者_如何转开发ication, and press the "X" button on my app, or my quit button which deploys: me.close It will not fully close the application. Like the instance is still running in Visual Studio or if you go to task manager processes you can still see it there. How would I get this to fully close?
If you do have thread(s) running within the app, set IsBackground
property as True
.
Thread.IsBackground Property on MSDN
Remarks
A thread is either a background thread or a foreground thread. Background threads are identical to foreground threads, except that background threads do not prevent a process from terminating. Once all foreground threads belonging to a process have terminated, the common language runtime ends the process. Any remaining background threads are stopped and do not complete.
One possibility is that you have some threads apart from the main thread running, and those aren't background threads. In general, try debugging it: attach to it from VS, and use Pause button to break it, and look at what threads are there, and what they are doing.
The "End" keyword is what you're looking for.
Put it in the FormClosed event.
精彩评论