Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I Have One Mdi Parent Form and Child Form.I want to save Child form Text box values on mdi parent Menu Button Click Event? i already write the coding but it not working 

Mdi Parent Form
C#
  private void toolStripButton2_Click(object sender, EventArgs e)
        {
            Sample Examplesave = new Sample();
            Form ActiveForm = this.ActiveMdiChild as Form;
            Examplesave.save();
}

Child Form
C#
public void save()
       {
           //Form ODTurning = this.ActiveMdiChild;
           strField = "VC,FP_REV,MAX_DIA,MIN_DIA,LENGTH,D_DUT,RPM,F_MIN,N_PASS,OD_CYCLE,CREATED_DT";

           strValue = "'" + Vc.Text + "','" + FeedPerRev.Text + "'";

           result = objDO.Saveop("Tbl_TURN", strField, strValue);

           if (result == true)
           {
               MessageBox.Show("INSERTED SUCCESSFULLY");
           }
           else
           {
               MessageBox.Show("Please verify your answer");

           }
          // btnODTsave.PerformClick();

       }
I open Child form and give the inputs of two text boxs(vc.text,feedperrev.text) but values didn't pass the values on this method. please give the examples or some tips. Thanks
Posted
Comments
jeevakumar.T 23-Sep-14 2:13am    
Thanks,I Need A Windows form application
BillWoodruff 23-Sep-14 5:15am    
Are there multiple child forms and each one of them has the two TextBoxes you describe ?

Why do you create a new instance of whatever 'Examplesave is every time the menu item is clicked ?

result = objDO.Saveop("Tbl_TURN", strField, strValue)

Where is that database created, and how does the Examplesave Class get access to it ?

Please describe more specifically exactly how it is not working.

1 solution

As the question turned out to be very popular, and my previous answers often were not well understood, probably were not clear enough, I decided to write a Tips/Trick article complete with detailed code samples and explanations: Many Questions Answered at Once — Collaboration between Windows Forms or WPF Windows.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900