c winform closes the form and terminates the thread implementation idea

  • 2020-05-09 19:06:16
  • OfStack

Not long ago, do an winform small program, is to give the customer derivative data. It was found that when debugging, there was something wrong with the thread, and at a certain point it stopped moving. But it really works fine.
It's just a bunch of processes in the explorer after closing the form.

At that time, the customer was in a hurry to use, a small test, the export of data is correct, the process left.
Later, I looked up the data myself and found that I could just set a property in the thread
 
Thread th = new Thread(Excute); 
th.IsBackground = true; That solves the problem.  

This property means that the thread is set to the background thread.
Then when you close the process, the thread closes.
I don't know what you have to do, more guidance

Related articles: