Home All Groups Group Topic Archive Search About

Call a MainForm from Another Form???

Author
1 Jun 2006 11:01 AM
bern11
I have the main form open another form, and I want the second form to
execute memeber functions on the main form?  How do you do this?  I
thought I could have a pointer (^) to the main form as a member variable
of the second form, and set it to the 'this' pointer just before showing
the form.  But, I cannot get that to compile.  The compiler does not
recognize the declaration statement (even though both forms are in the
same namespace), and if I add an include on the mainform header, it
screws up the include sequence and the main form doesn't compile
correctly (I end up with each form including the other).  This is
essentially what I tried:

<inside second form declaration'

MainProj::MainForm1^ mainFormPtr;   // Doesn't compile - says MainForm1
not a member of MainProj.  MainForm1 and 2nd form are in same namespace
and intellisense can figure it out...

MainForm1 includes 2ndForm.h and can create it.  I'm sure I'm doing
something simple quite wrong.....

AddThis Social Bookmark Button