更新时间:2023-02-20 18:06:38
看看BackgroundWorker类
MSDN BackgroundWorker类(System.ComponentModel) [ ^ ]
该链接将为您提供课程参考和示例
亲切的问候
而不是使用后台工作线程,虽然它确实可以很好地工作,但你应该考虑使用'任务'
.net中的任务可以等待和取消很容易
任务取消| Microsoft Docs [ ^ ]
hey, i made a start button and its to start the action or the job i want from my program to do
and there is a stop button to but if my program working i can't access to form to press stop button
is there anyway to make access to form while working possible ?
What I have tried:
how to stop threading while program working ?
Take a look at the BackgroundWorker class
MSDN BackgroundWorker Class (System.ComponentModel)[^]
The link will provide you with the class reference and examples
Kind Regards
Instead of using a Background Worker thread, which is sort-of old-school, though it does work quite well admittedly, You should consider using a 'Task'
Tasks in .net can be awaited and cancelled pretty easily
Task Cancellation | Microsoft Docs[^]