.NET VB WinForms reference to the class

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

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
 
Rick said:
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?

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.
 
I still would like to know how to do this in VB .NET, if anyone knows.

Thank you in adavance
 
Back
Top