private void button1_Click(object sender, EventArgs e)
{
PROGRESS_BAR.Minimum = 0;
PROGRESS_BAR.Maximum = 100;
PROGRESS_BAR.Value = 0;
for (int i = 0; i < 100; i++)
{
Thread t = new Thread(new ThreadStart(updateProgressBar));
t.IsBackground = true;
t.Start();
}
}
private void updateProgressBar()
{
PROGRESS_BAR.PerformStep();
Thread.Sleep(4000);
}
I always get this error: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on.
I tried to search in google for solutions and unfortunately all of them didn't work for me. does any one know how to solve this? thanks in advance..