Static and Global Variables?
-
Hey guys, I have a question that's been plaguing me for a day or so. I'll try to explain as best as possible. No code this time, just some general questions. I have a hierarchy of Windows forms, MainForm->AdminForm->JobDetailsForm. JobDetailsForm requires objects from MainForm, and AdminForm is just a middle man. Is there a slick way to get information from an object in MainForm to JobDetails form without passing the object through AdminForm? The object is an ArrayList of Objects called Users. I set information in the MainForm, and then I get that information inside of JobDetailsForm. Currently I'm doing something similar to Pseudo Code: MainForm ArrayList users; ... new AdminForm(users); AdminForm ... //no operations on users new JobDetailsForm(users) JobDetailsForm ... //some operations on users AdminForm has no use for users, it simply displays some information unrelated to users. If possible, I'd also like the operations preformed in JobDetailsForm to be reflected in the users object used in MainForm. I'm thinking a global or static variable could solve this, but from what I understand, there are no global or static variables in managed C++/CLI. Any ideas or suggestions?
[Insert Witty Sig Here]
-
Hey guys, I have a question that's been plaguing me for a day or so. I'll try to explain as best as possible. No code this time, just some general questions. I have a hierarchy of Windows forms, MainForm->AdminForm->JobDetailsForm. JobDetailsForm requires objects from MainForm, and AdminForm is just a middle man. Is there a slick way to get information from an object in MainForm to JobDetails form without passing the object through AdminForm? The object is an ArrayList of Objects called Users. I set information in the MainForm, and then I get that information inside of JobDetailsForm. Currently I'm doing something similar to Pseudo Code: MainForm ArrayList users; ... new AdminForm(users); AdminForm ... //no operations on users new JobDetailsForm(users) JobDetailsForm ... //some operations on users AdminForm has no use for users, it simply displays some information unrelated to users. If possible, I'd also like the operations preformed in JobDetailsForm to be reflected in the users object used in MainForm. I'm thinking a global or static variable could solve this, but from what I understand, there are no global or static variables in managed C++/CLI. Any ideas or suggestions?
[Insert Witty Sig Here]
VonHagNDaz wrote:
I'm thinking a global or static variable could solve this, but from what I understand, there are no global or static variables in managed C++/CLI.
If you choose that route, you can have a ref class with a static constructor and static member methods/properties/fields...How to: Define Static Constructors in a Class or Struct[^]
Mark Salsbery Microsoft MVP - Visual C++ :java: