Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42292

Cross-thread operation Issue

$
0
0
hI Friends,can anyone tell me ? . Why i am getting the following error when i try run the following code ?.it says the following
Cross-thread operation not valid: Control 'label1' accessed from a thread other than the thread it was created on.
Code:




            for (int i = 0; i < 10; i++)  {
                label1.Text = i.ToString();
                System.Threading.Thread.Sleep(500);
                backgroundWorker1.ReportProgress(i);
                label1.Refresh();

            }


Viewing all articles
Browse latest Browse all 42292

Trending Articles