title: accessing control in parent window from child window in c#
body: <p>I have a main "parent" window contains a button and a textbox.
  I have another window "child" window which fires when I enter some text in the textbox and click the button on the main window. now the child window contains another textbox and a button. what I need to do is to enter some text in the textbox on child window then when I hit the button on the child window the textbox on parent window should get updated with the text I entered from the child window..
  here is the sample:</p>
  
  <p>Form1.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Text;
  using System.Windows.Forms;
  
  namespace childform
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              Form2 tempDialog = new Form2(this);
              tempDialog.ShowDialog();
          }
  
          public void getText(string text)
          {
              textbox1.Text = text;
          }
  
      }
  }
  </code></pre>
  
  <p>Form2.cs </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Text;
  using System.Windows.Forms;
  
  namespace childform
  {
      public partial class Form2 : Form
      {
          private Form1 m_parent;
  
          public Form2(Form1 frm1)
          {
              InitializeComponent();
              m_parent = frm1;
          }
  
          private void button1_Click(object sender, EventArgs e)
          { 
              m_parent.getText(textbox1.text);
          }
      }
  }
  </code></pre>
  
  <p>any idea how to do this?</p>