M
Mike Johnson
I got the error below, can someone provide the answer in code to the problem
listed below. Thanks.
You have tried to reference a non-shared member of a class from within a
shared method or shared method initialize. The following code provides an
example of such a situation:
Class Sample
Public x as Integer 'An instance member
Public Shared Sub Bar()
x = 10 'Produces the error
End Sub
End ClassThe shared method does not actually operate on any one instance of
the class. Instead, each instance has its own copy of x, which causes the
error.
To correct this error
a.. Provide an explicit instance of the class whose member you wish to
reference. In the example above, provide an explicit instance of the class
containing the copy of x which you wish to set equal to 10.
I can't use shared to fix the problem so please explain in code how to do
the above. Thanks
listed below. Thanks.
You have tried to reference a non-shared member of a class from within a
shared method or shared method initialize. The following code provides an
example of such a situation:
Class Sample
Public x as Integer 'An instance member
Public Shared Sub Bar()
x = 10 'Produces the error
End Sub
End ClassThe shared method does not actually operate on any one instance of
the class. Instead, each instance has its own copy of x, which causes the
error.
To correct this error
a.. Provide an explicit instance of the class whose member you wish to
reference. In the example above, provide an explicit instance of the class
containing the copy of x which you wish to set equal to 10.
I can't use shared to fix the problem so please explain in code how to do
the above. Thanks