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.
chokkaStudentAsked:
Who is Participating?
 
paultantonyCommented:
You may also use System.Environment.Exit or end statement but both are ungraceful way of ending the program. you should close all the threads and forms and end gracefully. you may also try Environment.Exit(0)
0
 
packratt_jkCommented:
Either do a Thread.Join(threadobject), or else set the thread's IsBackground property to true (before you start it).
0
 
chokkaStudentAuthor Commented:
Can i get complete syntax ?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
"Application.Exit - is not killing all the thread which is invoked by Main Application."

Can you show us how you are creating the threads?...
0
 
chokkaStudentAuthor Commented:
Application is calling the Reports
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Can you show us how are opening these reports then?...
0
 
vivekpv10Commented:
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();
0
 
paultantonyCommented:
Try to close all threads using ExitThread and then use the Application.Exit
0
 
chokkaStudentAuthor Commented:

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

I have to wait for the results from Testing Team
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.