M
mosscliffe
I am trying to create Common Routines in a Class to use within my site,
but as usual I am struggling to understand the fundamentals.
I have the following
Class dbase
Public Shared Function MySub(ByVal tLookup, ByVal Flag) As String
Return MyFuncInSub("Test String")
End Function
Private Function MyFuncInSub(ByVal tLookup) As String
Return "Hello From My privateFuncFunction"
End Function
end class
The idea is I call the Shared part with
dim newstr as string = dbase.MySub
and during the processing of MySub, it calls the private Function
MyFuncInSub
BUT the compiler says
Error 1 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. C:\app_data\webdev\websites\pplists\App_Code\ListClasses.vb 114 16 C:\...\pplists\
If I change the Private Function to Public it gets through the
compiler, but does that not go against the principle of Private Parts
of a CLass.
Please can someone show me the light
Thanks
but as usual I am struggling to understand the fundamentals.
I have the following
Class dbase
Public Shared Function MySub(ByVal tLookup, ByVal Flag) As String
Return MyFuncInSub("Test String")
End Function
Private Function MyFuncInSub(ByVal tLookup) As String
Return "Hello From My privateFuncFunction"
End Function
end class
The idea is I call the Shared part with
dim newstr as string = dbase.MySub
and during the processing of MySub, it calls the private Function
MyFuncInSub
BUT the compiler says
Error 1 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. C:\app_data\webdev\websites\pplists\App_Code\ListClasses.vb 114 16 C:\...\pplists\
If I change the Private Function to Public it gets through the
compiler, but does that not go against the principle of Private Parts
of a CLass.
Please can someone show me the light
Thanks