I want the user to simply be able to exit my application. However, for some reason, code which I have on a time delay, controlled by a stopwatch, is still trying to execute. I do not care if it tries to do so or not, but I want to stop the error and force-quit the application, terminating ALL running threads where they stand.
I am using Visual Basic Express 2008 with SP1, and I am coding in vb.net, this is a WinForm application.
I have tried simply closing the forms with Formname.Close() and I also tried Application.Exit(). I even tried an If Then statement which exited the thread which referenced my textbox, quitting it with Application.ExitThread()
I got:
ObjectDisposedException was unhandled
Cannot access a disposed object. Object name: 'TextBox'.
How can I handle this exception or simply finish exiting?
Thanks for the help!
EDIT: To clarify, I don't care how this is achieved, I just want the application to stop running, and have no errors occur.