Hi Hi, Shirley,
Please refer to below,this may be useful to you .
private void button4_Click(object sender, EventArgs e)
(
if (button4.Text = 'suspend')
( toolStripStatusLabel1.Text ='suspend...';
button4.Text = 'continue';
for (int i = 0; i < threads.Length; i++)
( Thread thr = threads[i];
if (thr.ThreadState = ThreadState.Running)
( thr.Suspend() --Check whether the thread status is running, if yes, use Suspend method to suspend it
)
)
)
else
(toolStripStatusLabel1.Text = 'start..';
button4.Text = 'suspend';
for (int i = 0; i < threads.Length; i++)
( Thread thr = threads[i];
if (thr.ThreadState = ThreadState.Suspended)
( thr.Resume()
--Check whether the thread state has been suspended, if yes, use the Resume method to resume it }
)
)
)
Best Regards
Echo
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com