title: How to access and change value of parent window control from child window in C#
body: <p>Hi
  how can I change text value of text box in parent window from child window..</p>
  
  <p>i.e I have parent window have textbox1 and button and child window has textbox2 and button.
  I need to update the value of textbox1 when I enter some text in child window's textbox2.</p>
  
  <p>i did some simple function to do this logically its correct but its not working I have no idea why..</p>
  
  <p>parent.cs</p>
  
  <pre><code>namespace digdog
  {
      public partial class parent : Form
      {
          public parent()
          {
              InitializeComponent();
          }
  
          public void changeText(string text)
          {
              textbox1.Text = text;
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              //Display modal dialog
              child myform = new child();
              myform.ShowDialog();
  
          }
  
      }
  }
  </code></pre>
  
  <p>child.cs</p>
  
  <pre><code>namespace digdog
  {
      public partial class child : Form
      {
  
          public child()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
           parent mytexts = new parent();
           mytexts.changeText(textbox2.Text);
          }
      }
  }
  </code></pre>
  
  <p>any ideas will be appreciated 
  thanks in advance</p>