Hi,
In C++, if there's a class named clsMyForm, which has a static
("shared" in VB.NET) member variable named "Total" , and an instance
(object) of the class named oMyForm, the static member of the class,
can be referenced thru the instance as follows:
oMyForm::clsMyForm.Total
In VB .NET, if I have a Windows Form class named clsMyForm, which has
a shared member variable named "Total" , and an instance of the class
named oMyForm, how do I reference the shared members of the class thru
the instance oMyForm?
Thanks in advance,
Rick
Jon Skeet [C# MVP] - 11 Mar 2008 22:31 GMT
> In C++, if there's a class named clsMyForm, which has a static
> ("shared" in VB.NET) member variable named "Total" , and an instance
[quoted text clipped - 6 lines]
> named oMyForm, how do I reference the shared members of the class thru
> the instance oMyForm?
Regardless of whether you *can* do this in VB.NET (which I believe you
can, although these days it might produce a warning) it's a bad idea.
It leads the reader to think that it's an *instance* member. Just use
the type name, which makes it obvious that you're accessing a static
member.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Rick - 12 Mar 2008 14:46 GMT
I still would like to know how to do this in VB .NET, if anyone knows.
Thank you in adavance
Jon Skeet [C# MVP] - 12 Mar 2008 16:02 GMT
> I still would like to know how to do this in VB .NET, if anyone knows.
I believe you just reference it as if it were an instance member.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk