joltgbg
January 19th, 2007, 06:16 PM
This is the case:
I have created 2 Forms. Called ParentForm and ChildForm.
Parentform has a button, when this is clicked ChildForm is displayed.
ChildForm should then manipulate controls in Parentform.
In, c++, java or c# I would just do somethig likethis in Childform.
((Parentform^)this->GetParent())->RunTheFunction()
However in Managed c++ using VS 2005 I get errors.
Parentform and ChildForm are both in the same namespace so this shouldnt be a problem.
First I get an error saying.
"is not a class or namespace"
So I include childform.h in Parenform.h
Now it works to press the button in PArentform to display Childform.
Once in Childform I need to include parentform.h to be able to do the cast.
And now the sky starts falling down.
The compiler starts complaining again in Parentform that "...is not a class or namespace"
Any ideas? I feel im missing something here?
I have created 2 Forms. Called ParentForm and ChildForm.
Parentform has a button, when this is clicked ChildForm is displayed.
ChildForm should then manipulate controls in Parentform.
In, c++, java or c# I would just do somethig likethis in Childform.
((Parentform^)this->GetParent())->RunTheFunction()
However in Managed c++ using VS 2005 I get errors.
Parentform and ChildForm are both in the same namespace so this shouldnt be a problem.
First I get an error saying.
"is not a class or namespace"
So I include childform.h in Parenform.h
Now it works to press the button in PArentform to display Childform.
Once in Childform I need to include parentform.h to be able to do the cast.
And now the sky starts falling down.
The compiler starts complaining again in Parentform that "...is not a class or namespace"
Any ideas? I feel im missing something here?