Ciao
Devi separare la dichiarazione dalla definizione, lasciando la prima nel file .h, e mettendo la seconda nel file .cpp, in questo modo:
// Form1.h
// ...
public ref class Form1 : public Form {
// ...
private: System::Void button1_Click(Object^ sender, EventArgs^ e);
};
// Form1.cpp
#include "Form1.h"
#include "Form2.h"
System::Void Form1::button1_Click(Object^ sender, EventArgs^ e) {
Form2^ f2 = gcnew Form2();
f2->ShowDialog();
}
// Form2.h
// ...
public ref class Form2 : public Form {
// ...
private: System::Void button1_Click(Object^ sender, EventArgs^ e);
};
// Form2.cpp
#include "Form2.h"
#include "Form1.h"
System::Void Form2::button1_Click(Object^ sender, EventArgs^ e) {
Form1^ f1 = gcnew Form1();
f1->ShowDialog();
}
Fammi sapere se ci sono problemi, l'ho scritto senza testarlo
Luca