G
Guest
I have a form and in the form I have a sub that uses a class I instantiate
using
visual basic code: Public oCP As New Rs232 'instantiate the comm port
I need to share this sub with another form so to declare the sub I use
visual basic code: Public Shared Function IsPortAvailable(ByVal ComPort
As Integer) As Boolean
This gives me the following 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."
To resolve the error, MSDN says
"Provide an explicit instance of the class whose member you wish to
reference."
So how do I do that, and what does it mean to do that?
thanks
kevin
using
visual basic code: Public oCP As New Rs232 'instantiate the comm port
I need to share this sub with another form so to declare the sub I use
visual basic code: Public Shared Function IsPortAvailable(ByVal ComPort
As Integer) As Boolean
This gives me the following 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."
To resolve the error, MSDN says
"Provide an explicit instance of the class whose member you wish to
reference."
So how do I do that, and what does it mean to do that?
thanks
kevin