Possible Duplicate:
Help needed for 'cross-thread operation error' in C#
Solve a cross-threading Exception in WinForms
I've tried to add progressbar in the foreach-loop
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
foreach (...)
{
...
i++;
backgroundWorker1.ReportProgress(100 * i / rcount);
Thread.Sleep(100);
}
this.close();
}
now i have an Illegal Cross Thread Operation error in
this.close();
line
How can i solve it?