Thread: Update parent window from child?

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    89

    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

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    903
    I know nothing of C# (or at least that looks like it, or perhaps managed C++..) but I can tell you MDI is Multiple Document Interface.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SendMessage(add txt 2 listbox) won't work in WM_COMMAND
    By scwizard in forum Windows Programming
    Replies: 5
    Last Post: 12-12-2006, 07:25 PM
  2. child classes calling parent constructors (with arguments)
    By reanimated in forum C++ Programming
    Replies: 3
    Last Post: 05-01-2006, 10:52 AM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  4. opengl help
    By heat511 in forum Game Programming
    Replies: 4
    Last Post: 04-05-2004, 01:08 AM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM