(David Yaw's comment is correct, I write the following on the basis that the OP might need more explicit instructions. This answer is just pointing out usual C++ techniques, not something particularly specific to CLI/C++ or WinForms.)
It seems to me from your description that the body of your button-press event functions must have been in the respective header files. Furthermore, that #include "Form1.h" is in Form2.h, and vice-versa: this causing the circular dependency and associated pain.
The simple fix is to implement the event-handling methods in the Form1.cpp and Form2.cpp source files instead. Once the form designer creates the empty method...
public ref class Form 1 : System::Windows::Forms::Form
{
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
}
}
... then remove the implementation from the header.
public ref class Form 1 : System::Windows::Forms::Form
{
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) ;
}
Copy/Paste into the cpp file, and add the handler body
System::Void Form1::button1_Click(System::Object^ sender, System::EventArgs^ e) {
Form2^ frmProSog = gcnew Form2();
frmProSog->ShowDialog();
}
Remove the respective #include from the .h and put into the .cpp instead.
(If there is a member of Form1 which is a Form2^, forward declare Form2 in Form1.h)
The above will work because, on the basis of your question, there is no visual representation (i.e., in the form designer) of Form1 in Form2, or Form2 in Form1. In this case, you can have as much circular dependency as you like between forms/controls, as long as you forward declare in the *.h, and only "use" (access members, etc) circularly-dependent classes in source files. You can happily take handles (^) to Form2 in Form1.h with forward declaration, including Form2^ as member functions and method signatures.