Hello:
I am cleaning my code and trying to make whatever I can global. Global might not be the right terminology.
I put most of my global variables in the 'program.cs' and its working fine.
Is there a way to put the instances in there or make global some other way?
This is the line I would like to make golbal:
FormICEPack FormICEPack = Application.OpenForms["FormICEPack"] as FormICEPack;
I have this line in many places and in many programs/forms. Would like to just have it once.
Ho do I: Make an Instance global?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Hirendra SisodiyaRank #258 · 9.8K reputationPosted Apr 13, 2010, 10:15 PM EDT
you can do in this way:
declare FormICEPack as public static in your program.cs like :
public static FormICEPack frmICEPack;
and youcan initialize this on another form or as you wish like:
frmICEPack = Application.OpenForms["FormICEPack"];
now you can use frmICEPack as program.frmICEPack in anywhere in your application..
thanks
Please mark as answere if it helps
GustavoRank #1,990 · 732 reputationPosted Apr 14, 2010, 12:25 PM EDT
Thanks... I tried it in one form and it seems to work. Now I will go and do it to all my forms and then do my testing. Hopefully it will work all over. THANKS.