In my application I start a worker thread from a custom user control. When the control is disposed I abort the thread. The problem is that when the computer goes to sleep and the user closes the application my control is not disposed any more.
If I start a thread in my application how can I force it to be stopped when application is closed?
Bad idea. Aborting threads can (and often does) corrupt memory like data structures and such.
You need to set the
Thread.IsBackground = true.