Why doesn't this work?
The program stops on: this.textBox1.Text = "(New text)";
Thread demoThread;
private void Form1_Load(object sender, EventArgs e)
{
this.demoThread = new Thread(new ThreadStart(this.ThreadProcUnsafe));
this.demoThread.Start();
textBox1.Text = "Written by the main thread.";
}
private void ThreadProcUnsafe()
{
while (true)
{
Thread.Sleep(2000);
this.textBox1.Text = "(New text)";
}
}