unable to exit from my application

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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.

.



Relevant Pages

  • Re: Disable Database Close
    ... Users sometimes accidentally close the database when they meant to only close ... I'd like to make them start using File -> Exit to really ... I don't think you can do it that way, because the only technique I know of for preventing unintended closing via the X button would also prevent closing via File -> Exit. ... The hidden form's Unload event procedure would check the value of the check box, and cancel the Unload event if it is not set to True. ...
    (microsoft.public.access.formscoding)
  • Re: Disable Database Close
    ... This is called when the database loads: ... Dim c As CloseCommand ... MS Access from closing via the red X. ... I'd like to make them start using File -> Exit to ...
    (microsoft.public.access.formscoding)
  • Re: Question on CloseHandle and Threads
    ... To remove a thread object, you must terminate the thread, then close ... Through the documentation it seems that the thread proc must be exited ... is that my threads will exit whenever they want without notifying any other ... So who will take care of closing their handles? ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Leaving threads open??
    ... It's not a matter of closing the thread handle, ... Paul T. ... > Thanks for the reply Chris, although i'm not totally sure what more i can ... >> and then exit itself? ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: how to exit a form in this scenario?
    ... Try Me.Undo or DoCmd.RunCommand acCmdUndo before closing the form. ... > identity card number that a user inputs is valid. ... if user decides to exit after ... > Dim stDocName As String ...
    (microsoft.public.access.formscoding)