i have two forms form1 and form2 i can able to call form2 from form1 in button click event but not able to call form1 from form2 in click event.. i have included the respective header files also but still not working.

//this is in Form2.h
#pragma once

#include "Form1.h"
------
------
             }
    private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
                 Form1^ t=gcnew Form1();
                 t->Show();
             }



//this is in Form1.h

#pragma once

#include "Form2.h"
----
---

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

                                        Form2^ f=gcnew Form2();
                      f->Show();*/
             }

when i run this

Error   1   error C2065: 'Form1' : undeclared identifier    d:vc++testingformform1form1form2.h  115
Error   2   error C2065: 't' : undeclared identifier    d:vc++testingformform1form1form2.h  115
Error   3   error C2061: syntax error : identifier 'Form1'  d:vc++testingformform1form1form2.h  115
Error   4   error C2065: 't' : undeclared identifier    d:vc++testingformform1form1form2.h  116
Error   5   error C2227: left of '->Show' must point to class/struct/union/generic type d:vc++testingformform1form1form2.h  116
Error   6   error C2065: 'form2' : undeclared identifier    d:vc++testingformform1form1Form1.h  123
Error   7   error C2065: 't1' : undeclared identifier   d:vc++testingformform1form1Form1.h  123
Error   8   error C2061: syntax error : identifier 'form2'  d:vc++testingformform1form1Form1.h  123
Error   9   error C2065: 't1' : undeclared identifier   d:vc++testingformform1form1Form1.h  124
Error   10  error C2227: left of '->Show' must point to class/struct/union/generic type d:vc++testingformform1form1Form1.h  124
Error   11  error C2065: 'Form1' : undeclared identifier    d:vc++testingformform1form1form2.h  115
Error   12  error C2065: 't' : undeclared identifier    d:vc++testingformform1form1form2.h  115
Error   13  error C2061: syntax error : identifier 'Form1'  d:vc++testingformform1form1form2.h  115
Error   14  error C2065: 't' : undeclared identifier    d:vc++testingformform1form1form2.h  116
Error   15  error C2227: left of '->Show' must point to class/struct/union/generic type d:vc++testingformform1form1form2.h  116

Edited 3 Years Ago by Dani: Formatting fixed

This article has been dead for over six months. Start a new discussion instead.