This code works when not put in a thread, why does the label not change when it is put into a thread? Doing a Thread.Join also works. But that just slows down the UI..
public void Filechecker()
{
new Thread(() =>
{
if (status == 1)
{
for (int i = 0; i < 100; i++)
{
if (status == 0)
{
Labelstatus.Text = "Files okay";
Labelstatus.ForeColor = Color.Green;
break;
}
Thread.Sleep(100);
if (i == 99)
{
Labelstatus.Text = "Warning no activity 1";
Labelstatus.ForeColor = Color.Red;
}
}
}
}).Start();
}