title: How to get the value from active form to another form on UserControl using delegate
body: <p>My Winform application has 3 form: MainForm, Form1 and Form2.
  MainForm has an UserControl; when application starts, it calls MainForm, MainForm will be loaded and added Form1 onto UserControl:</p>
  
  <pre><code>private void MainForm_Load(object sender, EventArgs e)
  {
     Form1 frm = new Form1() { Dock = DockStyle.Fill, TopLevel = false, Visible = true };
     xtraUserControl1.Controls.Add(frm);
  }
  </code></pre>
  
  <p>On Form1, I use delegate:</p>
  
  <pre><code>    public delegate void Tranferdata(string txt);
      public Tranferdata _tranfer;
      private void Gettxt(string txt)
      {
          tbx_Recieve.Text = txt;
      }
  </code></pre>
  
  <p>Form1 has a button to call Form2:</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      Form2 frm2 = new Form2();
      frm2.ShowDialog(this);
  }
  </code></pre>
  
  <p>Form2 will send value to Form1 after closed, Code on Form2:</p>
  
  <pre><code>private void Form2_FormClosed(object sender, FormClosedEventArgs e)
  {
      using (Form1 frm1 = (Form1)this.Owner)
      {
         frm1._tranfer(tbx_Numb.Text);
      }
  }
  
  private void button1_Click_1(object sender, EventArgs e)
  {
     this.Close();
  }
  </code></pre>
  
  <p>But my code doesn't work correctly. It crashed at 'using (Form1 frm1 = (Form1)this.Owner)' and show the System.InvalidCastException.
  How can I fix this?</p>