title: How to update textboxes in main thread from another thread?
body: <p>How you update textboxes and labels in the main thread from a new thread running a different class.</p>
  
  <p>MainForm.cs (Main thread)</p>
  
  <pre><code>public partial class MainForm : Form
  {
      public MainForm()
      {
          Test t = new Test();
  
          Thread testThread = new Thread(new ThreadStart(t.HelloWorld));
          testThread.IsBackground = true;
          testThread.Start();
      }
  
      private void UpdateTextBox(string text)
      {
          textBox1.AppendText(text + "\r\n");
      }
  
  }
  
  public class Test
  {
      public void HelloWorld()
      {
          MainForm.UpdateTextBox("Hello World"); 
          // How do I execute this on the main thread ???
      }
  }
  </code></pre>
  
  <p>I have looked at the examples on here but cant seem to get it right. Please could someone give some good links.</p>
  
  <p>I have started again fresh so I don't mess up my code. If anyone would like to put up a working example with my example that would be great. </p>
  
  <p>Also if I had to update multiple objects like textboxes and labels etc (not all at the same time) what would be the best way to go about it, having a method for each textbox or is there a way to do this with one method?</p>