title: Passing Values from one Form to another Form in a Button click
body: <p>These are my 2 Forms.
  <a href="https://i.stack.imgur.com/9h8NB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9h8NB.png" alt="enter image description here"></a></p>
  
  <p>These are the codes for Form 1--></p>
  
  <pre><code>namespace Passing_Values
  {
      public partial class Form1 : Form
      {
          string a="preset value";
          public Form1()
          {
              InitializeComponent();
          }
  
          private void btnOpenF2_Click(object sender, EventArgs e)
          {
              new Form2().Show();
          }
  
          public void set(string p)
          {
              MessageBox.Show("This is Entered text in Form 2 " + p);
              a = p;
              MessageBox.Show("a=p done! and P is: " + p + "---and a is: " + a);
              textBox1.Text = "Test 1";
              textBox2.Text = a;
              textBox3.Text = p;
  
          }
  
          private void button2_Click(object sender, EventArgs e)
          {
              MessageBox.Show(a);
          }
      }
  }
  </code></pre>
  
  <p>These are the codes for Form 2--></p>
  
  <pre><code>namespace Passing_Values
  {
      public partial class Form2 : Form
      {
          public Form2()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              string g;
              g = textBox1.Text;
  
              Form1 j = new Form1();
              j.set(g);
          }
      }
  }
  </code></pre>
  
  <p>See the picture.You can understand the design.</p>
  
  <p>This is what I want to do. 1st I open Form2 using button in Form1. Then I enter a text and click the button("Display in Form1 Textbox"). When it's clicked that value should be seen in the 3 Textboxes in Form1.I used Message Boxes to see if the values are passing or not. Values get passed from Form2 to Form1. But those values are not displays in those 3 Textboxes but the passed values are displayed in Message Boxes. Reason for the 3 Text Boxes can be understood by looking at the code. So what's the error?</p>