Quote:
|
Originally Posted by 6600gt
I am using C++ and yes, I am trying to share variable as well as objects, such as serialPort1, between different forms. The object is only initialized in one form but I need to use it others. Any ideas?
Thanks
|
I don't know how to do this in C++, but I'm sure it'd be similar to what I'd do in C#.
Create a class with a name such as Globals, with static members for everything that you need to share.
Code:
public class Globals
{
public static int someNumber;
public static bool someBoolean;
// .. etc...
}
Then those could be accessed from anywhere, using Globals.someNumber, Globals.someBoolean, etc.