title: Changing Label From Another Form
body: <p>I've already searched other questions for this answer (and that is how I got as far as I did) and everything seems to be working except the end result. I am getting no errors but I am not getting the desired input and cannot figure out why.</p>
  
  <p>I have two forms, Form1 and login. On Form1 I have a label called "label2" that is going to display text entered from a textbox on login upon button press. Here is the code I have so far:</p>
  
  <p>Form1 Code:</p>
  
  <pre><code>    public void SetTextForLabel(string myText)
      {
          this.label2.Text = myText;
      }
  </code></pre>
  
  <p>login Code:</p>
  
  <pre><code>    private void button1_Click(object sender, EventArgs e)
      {
          Form1.userName = textBox1.Text;
          Form1.password = textBox2.Text;
  
          Form1 frm = new Form1();
          frm.SetTextForLabel(textBox1.Text);
  
          this.Close();
      }
  </code></pre>
  
  <p>The program works. I click login on form1, it opens up the login form. I enter my username and password and it passes the input to my form1 variables. Since label2 on form1 is not public, I made a public method to use on my login form that will change my label2.Text, but it doesn't and I'm not sure why. Any help would be appreciated.</p>