Possible Duplicate:
Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on.
I get an error message - can anyone give me some pointers.
Cross-thread operation not valid: Control 'pbx_1' accessed from a thread other than the thread it was created on.
I have had a look on here but i cant seem to get it to work. I am quite new to c# so I am probably missing something.
Console.WriteLine("backgroundWorker1");
while (!backgroundWorker1.CancellationPending) {
Thread.Sleep(100);
if (pbx_1.Location.X < Click_X) {
pbx_1.Location = new Point(20, pbx_1.Location.X + MoveAmt);
}
if (pbx_1.Location.X > Click_X) {
pbx_1.Location = new Point(20, pbx_1.Location.X - MoveAmt);
}
backgroundWorker1.ReportProgress(1);
}