How to reference function in shared function?

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Brett (no_at_spam.net)
Date: 02/12/05


Date: Fri, 11 Feb 2005 22:23:19 -0500

I'm trying to use the F1 function inside of F2 function below. I keep
getting the error posted below the code. If I remove the Shared
declaration from F2, it works fine. What exactly does the error mean?

Public Class myClass

Function F1(ByVal url As String) As Struct1
  -- do something --
End Function

Public Shared Function F2(ByVal value2 As String) As String
    F1(SomeValue) 'error references this line
    -- do something --
End Function

End Class

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.

I also tried this below the class declaration:

    Public F1_ As new myClass
    F1_.F1()

That gives an error saying 'Declaration Expected' on F1_, anywhere I try to
use it. Any suggestions on how I can reference F1 in F2?

Thanks,
Brett



Relevant Pages

  • Re: Is C99 the final C? (some suggestions)
    ... >> defined a function that returns an image string for a value of your ... >> need to decide how and whether the user can define precedence for the ... > of declaration. ... "parenthesize, parenthesize, parenthesize". ...
    (comp.lang.c)
  • Re: curious about array initialization.
    ... understanding that its through the variable declaration that we ... By "inline string", I assume you mean a string literal. ... more than that you have implicit storage. ... Its a concept from computer programming. ...
    (comp.lang.c)
  • Re: DhcpRequestParams from dhcpcsvc.dll
    ... it is because I do think that my own vb declaration is wrong, ... string to Unicode with StrConv and pass that as a string. ... Dim sendParams As DHCPAPI_PARAMS ...
    (microsoft.public.vb.winapi)
  • Re: curious about array initialization.
    ... understanding that its through the variable declaration that we ... By "inline string", I assume you mean a string literal. ... more than that you have implicit storage. ...
    (comp.lang.c)
  • Re: curious about array initialization.
    ... understanding that its through the variable declaration that we ... By "inline string", I assume you mean a string literal. ... more than that you have implicit storage. ...
    (comp.lang.c)