title: Sending information to a textbox from a class to a form
body: <p>I asked a question a couple of days ago about populating a listbox on a form from a class. It works and was great! However I now want to do the same with a textbox or a label. The answer from that question is below:</p>
  
  <blockquote>
    <p>What you are doing is creating a new instance of the form - I presume
    you are trying to add items in a listbox on an existing form?</p>
    
    <p>If so do this.</p>
    
    <p>Create a function on the form with the listbox like:</p>
  
  <pre><code>    public void addItemToListBox(string item)
      {
           listBox1.Items.Add(item);
      }
  </code></pre>
    
    <p>Then, in the class (remember to add the using System.Windows.Forms
    reference)</p>
  
  <pre><code>   public void doStuff()
      {
   //Change Form1 to whatever your form is called
   foreach (Form frm in Application.OpenForms)
   {
        if (frm.GetType() == typeof(Form1))
        {
             Form1 frmTemp = (Form1)frm;
             frmTemp.addItemToListBox("blah");
  
        }
   }
      }
  </code></pre>
  </blockquote>
  
  <p>This works well. Now I want to do the same with a textbox. I was wondering if someone could explain or if someone has a link on this? </p>
  
  <p>I have a form and a class. The form makes a new instance of the class and initiates a method in the class, say a maths equation 4+4; I want the answer, "8" to then be shown in a textbox or label on form1, from the method in the class. </p>