June 13th, 2012 12:56 PM
#1
[RESOLVED] Forms Singleton with Cyclic #Include ?
Hi
Iam using VC++2010. Earlier I learned from here but Iam facing the problem with Cyclic Include,
Any Ideas will be verymuch helpful to me... Thanks
Actually Form1 Codes
#include "Form2.h"
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Form2^ MyEmpLoan= Form2::GetForm(true,this);
MyEmpLoan->MdiParent=this;
MyEmpLoan->FormBorderStyle=System::Windows::Forms::FormBorderStyle::None;
MyEmpLoan->Dock=DockStyle::Fill;
MyEmpLoan->Show();
}
Form2 Codes
#include "Form1.h" //Its required because It's my MDIParent..I Need it's ToolStrip & Functions
public: static Form2^ Form2::_instance = nullptr;
public: static Form2^ Form2::GetForm(bool IsMDIChild, Form1^ MyInstFrm) {
if (_instance == nullptr)
_instance = gcnew Form2();
if (_instance->IsDisposed)
_instance = gcnew Form2();
if (IsMDIChild)
_instance->MdiParent = MyInstFrm;
return _instance;
}
But its giving below error
error C2065: 'Form2' : undeclared identifier
error C2065: 'MyEmpLoan' : undeclared identifier
error C2653: 'Form2' : is not a class or namespace name
Thanks
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks