Solved

Application.Exit - is not killing all the thread.

Posted on 2010-09-09
9
360 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

617 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