Public Shared

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • May

    #1

    Public Shared

    greetings, i came across a function while browsing thru
    the net. This function is created in a component. what i
    am curious to know is, is this the correct way to create a
    function using:
    Public Shared Function name() As String
    Don't we need some sort of parameter passing to use
    the "As String"? Maybe something like this:
    Public Shared Function name(ByVal fname As String)

    i am also curious as to why we need to use "Public Shared"
    and not just the keyword "Shared" alone. what is the
    difference between these two? thanx!
  • May

    #2
    Re: Public Shared

    sorry, but i still can get wat's the difference
    between "Sharing" and "Public". I've tried out both ways
    in creating a function in a component and i can still
    reference the component from various different web
    applications. So wat's the deal with shared and public?

    [color=blue]
    >-----Original Message-----[color=green]
    >> Public Shared Function name() As String[/color]
    >the function returns a string...
    >so you call name like thing
    >
    >Dim myNamePlease As String = name()
    >
    >[color=green]
    >> Public Shared Function name(ByVal fname As String)[/color]
    >
    >Public means anyone on the outside that has an instanse[/color]
    of the object can[color=blue]
    >access it.
    >Shared, (more like Static), means that the same member is[/color]
    called if you have[color=blue]
    >two objects both calling one member.
    >
    >it could have just been Shared in this case because the[/color]
    automatic attribute[color=blue]
    >is Public, unless Private or Protected is specified...
    >
    >Think that's right!
    >
    >
    >
    >"May" <marianne_too@h otmail.com> wrote in message
    >news:00ba01c34 629$02e177c0$a1 01280a@phx.gbl. ..[color=green]
    >> greetings, i came across a function while browsing thru
    >> the net. This function is created in a component. what i
    >> am curious to know is, is this the correct way to[/color][/color]
    create a[color=blue][color=green]
    >> function using:
    >> Public Shared Function name() As String
    >> Don't we need some sort of parameter passing to use
    >> the "As String"? Maybe something like this:
    >> Public Shared Function name(ByVal fname As String)
    >>
    >> i am also curious as to why we need to use "Public[/color][/color]
    Shared"[color=blue][color=green]
    >> and not just the keyword "Shared" alone. what is the
    >> difference between these two? thanx![/color]
    >
    >
    >.
    >[/color]

    Comment

    Working...