In vb.net, how do you force quit the app and compress error messages?

I want the user to just be able to log out of my application. However, for some reason, the code I have on the time delay controlled by the stopwatch is still trying to execute. I don't care if it tries to do it or not, but I want to stop the error and force close the application, terminating ALL the running threads where they stand.

I am using Visual Basic Express 2008 Service Pack 1 (SP1) and I am coding in vb.net, this is a WinForm application.

I tried to just close the forms using Formname.Close () and I also tried Application.Exit () . I even tried an If Then statement that exited the thread that was referencing my textbox by exiting it with Application.ExitThread ()

I got:

ObjectDisposedException was not handled

Unable to access the remote object. Object name: "TextBox".

How can I handle this exception or just end up exiting?

Thanks for the help!

EDIT. To clarify, I don't care how this is achieved, I just want the application to stop working and there are no errors.

+2


source to share


2 answers


Can you turn off the stopwatch before exiting?



+1


source


Worst solution for your problem:

Process.GetCurrentProcess.Kill()

      



Regards, Zibri

+2


source







All Articles