G
Guest
I want to access an object that is instantiated in the frmMain method from within a static method. When I try to access this object, I get errors that state "Object reference not set to an instance of an object."
I know this is a scope problem, but I don't know how to solve it. My application is a winforms app and I'm instatiating the object from frmMain(). The object is declared:
public static DataAccess myDataAccessor;
What do I need to do? Why isn't this public object accessible throughtout my application? Is there a better place than frmMain where objects that should be accesssible throughout an application reside? I'd like to avoid passing objects that already exist as arguments if I'm creating objects that are meant to be accessible througout my app.
Thanks!
I know this is a scope problem, but I don't know how to solve it. My application is a winforms app and I'm instatiating the object from frmMain(). The object is declared:
public static DataAccess myDataAccessor;
What do I need to do? Why isn't this public object accessible throughtout my application? Is there a better place than frmMain where objects that should be accesssible throughout an application reside? I'd like to avoid passing objects that already exist as arguments if I'm creating objects that are meant to be accessible througout my app.
Thanks!