Link to home
Start Free TrialLog in
Avatar of chokka
chokkaFlag for United States of America

asked on

Application.Exit - is not killing all the thread.


VS 2005 / VB.Net

Application.Exit - is not killing all the thread which is invoked by Main Application.

How to kill all the threads, when we execute the application.
Avatar of packratt_jk
packratt_jk
Flag of United States of America image

Either do a Thread.Join(threadobject), or else set the thread's IsBackground property to true (before you start it).
Avatar of chokka

ASKER

Can i get complete syntax ?
Avatar of Mike Tomlinson
"Application.Exit - is not killing all the thread which is invoked by Main Application."

Can you show us how you are creating the threads?...
Avatar of chokka

ASKER

Application is calling the Reports
Can you show us how are opening these reports then?...
try defining the thread you are creating  as a Background worker,
when you define the thread. like this...
thread t = new thread(new threadstart(function));
t.IsBackground = true;
t.Start();
Avatar of paultantony
paultantony

Try to close all threads using ExitThread and then use the Application.Exit
ASKER CERTIFIED SOLUTION
Avatar of paultantony
paultantony

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chokka

ASKER


 Now i have replaced the code from Application.Exit to Environment.Exit(0)

I have to wait for the results from Testing Team