المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : how to stop the current process



C# Programming
01-12-2010, 01:31 AM
there are two buttons in my layout.one is "start" the other is "stop".
when i click the "start" button it will excute the programe.it will expend long time to excute. so the user will click the "stop" button to stop the current operation.
there is two problem to solve:
1, when click the "start" button the "stop" button must can be operated.
2, stop the current porcess's excute.

i have wriited the code as this:
//i want to make the layout's other control can be operated,but failire
System.Windows.Forms.Application.DoEvents();
//abort the current main thread
System.Threading.Thread.CurrentThread.Abort();

thank you!