title: C# storing a string value from textbox and calling that variable
body: <p>I am trying to write a C# based winform to do a several automated text entry processes as part of my work. I wish to have certain things entered into textboxes, saving me from doing it manually.</p>
  
  <p>I am able to store the inputted data from a textbox as a string variable but I wish to know how I could call this upon clicking on a seperate textbox. Thus "copying" the data inside one box and placing it elsewhere, on several occasions.</p>
  
  <p>I am not 100% sure this is how the string should be stored but this is my attempt:</p>
  
  <pre><code>    private void textBox1_TextChanged(object sender, EventArgs e)
      {
          string chattextbox;
      }
  </code></pre>
  
  <p>I want the stored string variable to be entered below</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      Application.OpenForms["Loginwindow"].BringToFront();
  }
  </code></pre>
  
  <p>After bringing the window to the front I wish to call the data from the string variable and have it KeyPress "Enter"</p>
  
  <p>Hope I have made it clear as to what I am trying to do.</p>
  
  <p>Thanks all</p>