Consider the following program:

The class definition has 2 variables, one that is shared
and one that is not. They are both public so that I would
not dirt the water for the example being analyzed. The program
produces the following output:

Value = 6
Value = 7
Value = 7
Value = 8
NonShared = 15

Imports System.Console
Class clsTestClass
Public Shared lngValue As Long = 6
Public lngNonSharedValue As Long = 15
End Class
Module Module1
Sub Main()
Dim TestClass As clsTestClass
' NOTE 1
WriteLine("Value = {0}", clsTestClass.lngValue)
clsTestClass.lngValue = 7
WriteLine("Value = {0}", clsTestClass.lngValue)
' NOTE 2
' WriteLine("Value = {0}", clsTestClass.lngNonSharedValue)
' NOTE 3
TestClass = New clsTestClass()
WriteLine("Value = {0}", TestClass.lngValue)
TestClass.lngValue = 8
WriteLine("Value = {0}", TestClass.lngValue)
' NOTE 4
WriteLine("NonShared = {0}", TestClass.lngNonSharedValue)
End Sub
End Module


Don't be alarmed at the format for the WriteLine statement. Since VB.NET
and C## share the CLR you can use the same formats with either language.
If you rather, the 1st WriteLine could have been written as:

WriteLine ("Value = " & clsTestClass.lngValue.ToString())
WriteLine ("Value = " & CStr(clsTestClass.lngValue))

What is the important part of NOTE 1 is that I am able to refer to
public shared variables of a class by using the class definition name.
I do NOT need to instantiate a copy of the class to refer to these types
of variables. This has immediate implications for run-time initialization
of these type of variables and what every programmer wants a holding class
for global data that doesn't require methods, constructors, or destructors.


The statement immediately following NOTE 2 is not permitted (VB complains,
as it should). I have attempted to access a variable that is not shared.
Non-shared variables can only be accessed from instantiated class. The
variables do not exists until instantiation. In VB.NET, instantiation
occurs with the application of the New clause to an object.


I finally get around to instantiation. Now is the first time I can access
the nonshared variable of the class. As I demonstrated in my earlier
epistle "How To Do It - Shared Class Variables", you can access shared
variables by either their class definition name or instantiation name.

When I reference a nonshared variable I must do so using the named object
I instantiated, in this case, TestClass.