Parent/Child forms communication issue

Posted by user361583 on Stack Overflow See other posts from Stack Overflow or by user361583
Published on 2010-06-08T16:30:24Z Indexed on 2010/06/08 16:32 UTC
Read the original article Hit count: 158

Filed under:

Hi, I am very new to Visual C++ programming, but I have to write simple program which needs to do two things: ( I am using MS Visual C++ )

  1. main ( parent ) form should be displayed when program starts, and after clicking a button on it, second form should be shown.
  2. Second form ( child ) also has a button, but this one should ( after clicking, of course ) show current X,Y child form position but on ( important ): parent form.

And this is where i got stuck.

I can display child form with: a) adding #include "child.h" in parent form.h b) adding child ^child_form; in public: section

and afterwards using:

child_form = gcnew child(); child_form->Show();

I was googling for two days now and cannot find a way to get it the other way: click on a button on child_form and display it's coordinates on parent form on label->text :/

when i tried to add #include "child.h" in child_form I just got error saying: "there are to many include files..."

I really need to get this done and I would really appreciate any suggestions.

Thanks in advance :)

© Stack Overflow or respective owner

Related posts about visual-c++