title: Appending To TextBox From Another Class and Thread C#
body: <p>I have a form that sets up and displays the text box.  In the form load method, I am starting a new thread from a completely separate class name <code>Processing</code>:</p>
  
  <pre><code>    private void Form1_Load(object sender, EventArgs e)
      {
          Processing p = new Processing();
          Thread processingThread = new Thread(p.run);
          processingThread.Start();
      }
  </code></pre>
  
  <p>Here is the processing class.  What I would like to do is create a method in <code>Utilities</code> class that will allow me to update the text box from whatever class I would need to:</p>
  
  <pre><code>public class Processing
  {        
      public void run()
      {               
          Utilities u = new Utilities();
  
          for (int i = 0; i &lt; 10; i++)
          {
              u.updateTextBox("i");
          }                    
      }
  
   }
  </code></pre>
  
  <p>Then finally the <code>Utilites</code> class:</p>
  
  <pre><code>class Utilities
  {
      public void updateTextBox(String text) 
      {
          //Load up the form that is running to update the text box
          //Example:  
          //Form1.textbox.appendTo("text"):
      }
  }
  </code></pre>
  
  <p>I have read about the <code>Invoke</code> methods, <code>SynchronizationContext</code>, Background threads and everything else, but almost all examples are using methods in the same class as the <code>Form</code> thread, and not from separate classes.</p>