I'm working on an app which uses a parent form and child forms in C++.Net. I want to access a static arraylist variable of the parent form from a child form. In order to do so, I wanted to use the MDIParent property like this:
Form1 ^parentForm = (Form1 ^)this->MdiParent;
where Form1 is the parent's class. Then use parentForm to get the arraylist variable. Currently, this code is implemented in another header file from which Form1 is defined. In normal C++ I would have used extern ref class Form1 to let the compiler know the Form1 class is defined elsewhere. But now I get the following error:
warning C4669: 'type cast' : unsafe conversion: 'System::Window s::Forms::Form' is a managed type object
How can this be solved? Is there another way in C++.NET to access the variable?
Form1 ^parentForm = (Form1 ^)this->MdiParent;
where Form1 is the parent's class. Then use parentForm to get the arraylist variable. Currently, this code is implemented in another header file from which Form1 is defined. In normal C++ I would have used extern ref class Form1 to let the compiler know the Form1 class is defined elsewhere. But now I get the following error:
warning C4669: 'type cast' : unsafe conversion: 'System::Window s::Forms::Form' is a managed type object
How can this be solved? Is there another way in C++.NET to access the variable?