global pointer on second form (managed)?

  • Thread starter Thread starter Lupina
  • Start date Start date
L

Lupina

How to do global pointer , which indicates on the second form ?

If I want e.g. invoke another form I do it like this :



private: System::Void menuItemDlg_Click(System::Object * sender,
System::EventArgs * e)

{

DIALOG1 *myDlg = new DIALOG1;

myDlg->Show();

}

but I want to use "myDlg " in all functions my MainForm. How to declare
myDlg as global pointer?
 
Lupina said:
How to do global pointer , which indicates on the second form ?

If I want e.g. invoke another form I do it like this :



private: System::Void menuItemDlg_Click(System::Object * sender,
System::EventArgs * e)

{

DIALOG1 *myDlg = new DIALOG1;

myDlg->Show();

}

but I want to use "myDlg " in all functions my MainForm. How to declare
myDlg as global pointer?

Why do you need a global for this ? Why not just make a member ?

Outside any function, but inside the class :
DIALOG1* myDlg;

And then in the MainForm constructor :
myDlg=new DIALOG1();
 
Back
Top