473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Public Shared

May
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!
Nov 17 '05 #1
1 3991
May
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?

-----Original Message-----
Public Shared Function name() As Stringthe function returns a string...
so you call name like thing

Dim myNamePlease As String = name()

Public Shared Function name(ByVal fname As String)


Public means anyone on the outside that has an instanse

of the object canaccess it.
Shared, (more like Static), means that the same member is called if you havetwo objects both calling one member.

it could have just been Shared in this case because the automatic attributeis Public, unless Private or Protected is specified...

Think that's right!

"May" <ma**********@hotmail.com> wrote in message
news:00****************************@phx.gbl...
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!

.

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: THY | last post by:
Hi, I am having some problem, I declare few variable in a public module and use them in the web application. But after that I found that the variable declared in public variable =...
3
by: Joe Fallon | last post by:
I have a Shared varibale in a base class and all the Shared methods in the sub-classes use it (and CHANGE it). I thought I was saving myself the "trouble" of Dimming this variable inside each...
10
by: darrel | last post by:
I'm still trying to sort out in my head the differences between public and shared when referring to declaring properties or variables. This is my understanding: shared - akin to a 'global'...
4
by: Chris | last post by:
Hello, I'm just getting started with VB and am new to the group, so please excuse what may seem to be a rudimentary question. I've been writing basic programs and have noticed that the...
5
by: Neil Steventon | last post by:
Hi, I am new to VB.net , well the objects concept anyway and was wondering if there were any good articles / turorials on when and why you would use certain declarations such as Private test...
2
by: Jon Paal | last post by:
In a 2.0 vb code class, I have a private property and a shared public function The property value has already been passed into the class, now I am trying to use a public finction which also needs...
2
by: Darrel | last post by:
I'm working on an app where the ASPX pages aren't precompiled with the class.vb files I'm. This is so people can add their own ASPX pages down the road to the app (the .aspx pages become...
8
by: Al | last post by:
I'd like to create Class Library in VB 2005, which has a property accessible by external programs. I decided to include 1 Class with 1 property in this project. I placed this code in Class:...
9
by: Rudy | last post by:
Hello All! I'm a little confused on Public Class or Modules. Say I have a this on form "A" Public Sub Subtract() Dim Invoice As Decimal Dim Wage As Decimal Static PO As Decimal Invoice =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.