zul hayat

zul hayat

  • 1.7k
  • 53
  • 1.1k

Getting value from child form to parent form.

Feb 16 2019 6:43 AM
I have a form opening in tabcontrol. Through this a child form apears in the screen. when i pass value from child form parent form it gives error of ownership (Main form). when I changed the ownership of the form to the other form, error of ownershiop has gone. But a new error has come, that my child form does not passing values to other parent form. 
My code is given below, when the child form is going to be open.
 
  1. private void button11_Click(object sender, EventArgs e)
  2. {
  3. using (New_Category new_Category = new New_Category("ProductDefinition"))
  4. {
  5. new_Category.ShowDialog();
  6. }
  7. }
 and now the child form value passing to parent form
 
  1. Product_Defination prod = new Product_Defination("","");  
  2. Main_form main = new Main_form("""");  
  3. prod.Owner = (Main_form)this.Owner;  
  4. prod.get_productid_notifyme(Product_id);  
 What should i do that my parent form accept the values from child form. 
Point to be noted that when i removed the coding of tabcontrol then this code is ok.  

Answers (1)