A button on the parent form is used to start the thread. If the parent form is closed in the development environment the thread keeps running in the background preventing edits to the source code on a 64 bit Windows 7 platform. The thread has to be killed by Menu > Debug > Stop Debugging. What is the proper way to programmatically kill the thread when the parent Form is closed?
private void buttonW_Click(object sender, EventArgs e)
{
Thread t = new Thread(Main.MyThread);
t.Start();
}
private static void MyThread()
{
...
}
See Question&Answers more detail:os