Gut, dann ist
Abort doch richtig.
allerdinsg scheint nichts zu passieren:
Code:
private void btnStop_Click(object sender, EventArgs e)
{
if (rbThread.Checked)
{
t.Abort();
}
else
{
backgroundWorker1.CancelAsync();
}
}
private void thread1_Event(object sender, EventArgs e)
{
try
{
if (InvokeRequired)
{
Invoke(new EventHandler(thread1_Event));
}
else
{
for (int i = 0; i < 100000; i++)
{
lblStatusText.Text = resManager.GetString("ThreadStatusRunning");
this.Update();
Thread.Sleep(0);
}
}
}
catch (ThreadAbortException tae)
{
lblStatusText.Text = resManager.GetString("ThreadStatusFinish");
this.Update();
}
}
private void ThreadProc()
{
try
{
thread1_Event(this, null);
}
catch (ThreadAbortException tae)
{
lblStatusText.Text = resManager.GetString("ThreadStatusFinish");
this.Update();
}
}
Laut Beispiel aus der Hilfe, müsste es aber so aussehen.