By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,877 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

Shared Methods in VB 2005 Beta 2

P: n/a
Is there anyway to access a Shared method from within an instance of a
class.

public class MyClass
Shared Readonly Property myProp() as string
Get
return "MyProp Example"
End Get
End Property
end class

I want to use this as:

dim mc as new MyClass
debug.print mc.myProp

and

debug.print MyClass.myProp

Thanks,
Mike Ober.

Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Michael D. Ober" <mdo.@.wakeassoc..com> schrieb:
Is there anyway to access a Shared method from within an instance of a


"My Project" -> "Compile" -> "Instance variable accesses shared member" ->
"None".

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

P: n/a

Thanks - After looking at this and then looking up exactly what this error
is about, I have modified my class to not use the Shared properties to
comply with the .NET programming model.

Mike.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ul**************@TK2MSFTNGP12.phx.gbl...
"Michael D. Ober" <mdo.@.wakeassoc..com> schrieb:
Is there anyway to access a Shared method from within an instance of a


"My Project" -> "Compile" -> "Instance variable accesses shared member" ->
"None".

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Nov 21 '05 #3

P: n/a
Turns out Public Const is what I actually need.

Mike.

"Michael D. Ober" <obermd.@.alum.mit.edu.nospam> wrote in message
news:Xw*****************@newsread1.news.pas.earthl ink.net...

Thanks - After looking at this and then looking up exactly what this error
is about, I have modified my class to not use the Shared properties to
comply with the .NET programming model.

Mike.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ul**************@TK2MSFTNGP12.phx.gbl...
"Michael D. Ober" <mdo.@.wakeassoc..com> schrieb:
Is there anyway to access a Shared method from within an instance of a


"My Project" -> "Compile" -> "Instance variable accesses shared member" -> "None".

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>



Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.