B
Brett
In a class, I have several Private subs. I declare an instance of the class
such as:
Dim MySelf as new Class1
within a private sub. The motive is to provide access to other subs within
the same class. Is this correct?
It would be nice to declare the MySelf instance in the Class public space
(just under Private Class Class1). That will give this error:
Cannot refer to an instance member of a class from within a shared
method or shared member initializer without an explicit instance of the
class.
If I declare
Private Class Class1
outside of a sub or function, isn't that an instance of the class? Why
can't the other subs use this (refer to above error).
What is the best method of declaring an instance of a class for subs within
that class to have access to the instance?
Thanks,
Brett
such as:
Dim MySelf as new Class1
within a private sub. The motive is to provide access to other subs within
the same class. Is this correct?
It would be nice to declare the MySelf instance in the Class public space
(just under Private Class Class1). That will give this error:
Cannot refer to an instance member of a class from within a shared
method or shared member initializer without an explicit instance of the
class.
If I declare
Private Class Class1
outside of a sub or function, isn't that an instance of the class? Why
can't the other subs use this (refer to above error).
What is the best method of declaring an instance of a class for subs within
that class to have access to the instance?
Thanks,
Brett