Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I delare a shared function in a class

Status
Not open for further replies.

caso

Programmer
Sep 16, 2002
7
GB
I am trying to call a method in a class without instantiating the class.
MSDN is telling me to declare as follows:

Public Shared Function xxx() as Boolean

However when hitting enter the message "identifier expected" is appearing?
Do I need any other declarations...
Thanks in advance for any help
 
What exactly are you looking at in MSDN? You can't call a method of a class without first instantiating that class. Likewise, I'm unfamiliar with the "Shared" keyword you're using between the "Public" and "Function" keywords and I can't find it in my MSDN documentation for VB. Can you point me to where you're finding your example?
 
Nagrom , I am using MSDN July 2003 in the Visual Basic Language section 7.1 Methods. I searched for Static methods and it pointed me to this chapter. I am looking in completly the wrong place ?
Cheers Caso
 
caso is talking about VB.Net, in which case they need to ask over in the VB.Net forum796
 
Posts crossed.

caso, Are you using VB.Net, or VB6?
 
CCLINT,
Thanks for pointing me in the right direction. I will try searching that forum
 
Aaaah, that would explain it - I haven't been lucky enough to get to work with .Net at my current job (despite much cajoling by me to do just that).
 
CLINT,
I am actually using VB6 which may be the problem...
 
Then you need the VB help files from MSDN October 2001 - came with the VB6.
 
Thank you both for your help.... I will looking the correct help files !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top