Update parent window from child?
I have a window that displays product information. You can edit the info by clicking the edit button and a new form pops up where all the fields can be changed in various ways. When you are done you can click Save or Cancel. What I am trying to do is when the user clicks 'Save' and the product is changed, get the parent window to automatically display the updated information. I tried doing the following [pseudo-code]:
parent window Edit button:
Code:
private: System::Void bEdit_Click(System::Object^ sender, System::EventArgs^ e) {
properties_form ^pf = gcnew properties_form;
//set the fields in pf to the correct values, based on values from fields in this form
pf->MdiParent = this;
pf->show();
}
child window save button:
Code:
private: System::Void bSave_Click(System::Object^ sender, System::EventArgs^ e){
//get the new info from the editable fields
//make a new product to hold the info
//replace the old product with the modified one in the DB
ParentForm->Refresh();
Close();
}
this code compiled but gave me an error saying the parent form is not an mdi container. I don't even know what an MdiContainer is but I just trying to work with what I could find on MSDN before asking silly questions here. Now I'm stuck and here I am... thanks :)