Thread-safe updating of controls from another thread
https://stackoverflow.com/questions/661561/how-do-i-update-the-gui-from-another-thread
Another method (from BB)
private void buttonOk_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; buttonOk.Enabled = false; int count = 0; SaveSettings(); for (int i = 0; i < (int)NoOfMessages; i++) { new Thread(new ThreadStart(() => { Stopwatch watch = new Stopwatch(); watch.Start(); var message = PerformWork(.........); watch.Stop(); var tempCount = ++count; Invoke(new MethodInvoker(() => { textBoxLog.Text += "Message " + (tempCount) + " done." + Environment.NewLine; if (tempCount == (int)NoOfMessages) { Cursor = Cursors.Default; buttonOk.Enabled = true; } // Console.WriteLine("DONE " + tempCount); })); })).Start(); } }