I have a class called Form1, which has a button in it. Now in that class I made another thread.
If I try to change the button in any way from the new thread, I get the cross-thread error/exception
new Thread(delegate ()
{
while (!DL.HasExited)
{
Thread.Sleep(500);
}
File.Delete(folderBrowserDialog1.SelectedPath + @"\Steam\steamcmd.zip");
//The code below this note is the problem
button1.Text = "START DOWNLOADING";
button1.Enabled = true;
}).Start();
I need to have the code in the new Thread, because I don't want to make my program freeze when it reaches the while loop.
So how can I change the button text from a different thread?