Hi there,
I understand that there are a number of discussions about this, some of which have been solved, but I can't seem to get my head around this issue or understand these discussions.
This is what I want to do:
Two forms named Form1 and Form2.Form1 has a button which hides Form1 and loads Form2. Form2 has a button which hides Form2 and loads Form1. Simple!
But I have errors. This is what I've coded:
Form1.h has #include "Form2.h" at the beginning of its code. For its button its code is:
1 2 3 4 5
|
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
this->Hide();
Form2^ form2 = gcnew Form2();
form2->ShowDialog();
}
|
Note: Without adding code to Form2.h the above works without error.Obviously, Form2's button is inactive.
Form2.h has #include "Form1.h" at the beginning of its code. For its button, its code is:
1 2 3 4 5
|
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
this->Hide();
Form1^ form1 = gcnew Form1();
form1->ShowDialog();
}
|
I think I understand that it has something to do with the order of #includes in each header. I may be wrong.
If it is a simple task, could someone please provide me with a step - by - step
guide on what to do? I would really appreciate this.
Thanks in advance.