-
April 22nd, 2012, 09:19 AM
#1
[RESOLVED] Forms SingleTon VC++2010?
Hi,
Iam using the below code for forms singleton in c#.. When I convert it to VC++ its giving error..
c# code
======
private static Form2 _instance = null;
public static Form2 GetForm (bool IsMDIChild, Form1 frm)
{
if (_instance == null)
_instance = new Form2();
if (_instance.IsDisposed)
_instance = new Form2();
if (IsMDIChild)
_instance.MdiParent = frm;
return _instance;
}
I convert it like a below.. to vc++2010
===========================
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
01. Error c2061 Syntax error : Identifier 'Form1'
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
|