unable to exit from my application

H

Hari

Hi,
my application contains an "Exit" menu item, when clicked should
exit from my application. Initially i used Application.Exit(). But that
was hanging the application and the application was not responding.
Even the form was not closing. Later i tried it with this.Close(). It
was closing the form. But still not exiting from the application. The
application contains a thread which runs in background to receive and
send messages on a socket. May be the thread was not stopped.
So i tried it in other way. I declared a static boolean variable in a
seperate class and looping in the thread until it is set to true. And
i'm setting the variable to true when the exit menuitem is selected and
then closing the form. Still it does'nt work. It closes the form but
does'nt return the control. What could be wrong. Any other solution? I
would be very thankful to any one who can help me.
 
G

Guest

Your thread isn't exiting. Put a break point in the thread code agter it
checks the global variable and is supposed to exit and then run in debug
mode to see if it ever hits that break. It likely won't, which means you
need to debug the app.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top