Solved

Application.Exit - is not killing all the thread.

Posted on 2010-09-09
9
359 Views
Last Modified: 2012-05-10

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.
0
Comment
Question by:chokka
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 3

Expert Comment

by:packratt_jk
ID: 33641909
Either do a Thread.Join(threadobject), or else set the thread's IsBackground property to true (before you start it).
0
 

Author Comment

by:chokka
ID: 33642094
Can i get complete syntax ?
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 33642191
"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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:chokka
ID: 33642200
Application is calling the Reports
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 33642231
Can you show us how are opening these reports then?...
0
 
LVL 5

Expert Comment

by:vivekpv10
ID: 33643760
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
 
LVL 1

Expert Comment

by:paultantony
ID: 33643796
Try to close all threads using ExitThread and then use the Application.Exit
0
 
LVL 1

Accepted Solution

by:
paultantony earned 500 total points
ID: 33643806
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
 

Author Comment

by:chokka
ID: 33760945

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

I have to wait for the results from Testing Team
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question