//I want to start a thread that set postion of a la lable here is part of the code
t = new Thread(bar);
t.Start();
public void bar()
{
while (true)
{
label2.Location = new Point(this.label2.Location.X + 10, this.label2.Location.Y);
Thread.Sleep(1000);
if (this.label2.Location.X > this.Width)
{
label2.Location = new Point(200-this.label2.Width + 10, this.label2.Location.Y);
}
}
}
//here is the problem
//Invalid cross-thread operation: Control 'Form1' has been accessed from a thread other than the one on which it was created.