This is one thing that annoys me about Visual Basic, mostly from the angle of a VB
.NET programmer trying to move to C#. Anyway.
This may get a bit confusing but try and bear with me.
The shared keyword is most similar to the static keyword in C# essentially what it means is that a method belongs to a class and not an instance of a class. So
Public Shared Sub foo()
Public Sub fooNew()
'end class definitnion
So now you have a Shared sub and an instance member sub that you would access like this respectively:
Dim c as New MyNewClass()
The static keyword, as your defintion states: A static variable continues to exist for the lifetime of the class or module in which it is defined.
So this is what it means:
Public Sub foo(i as Integer)
Static newI As Integer
newI = i
and you made a call like this:
your output would be:
And Option Explicit means that the compiler forces you to declare your variables (this is the default in VS), however, if you set Option Explicit Off it is legal to do something like
Public Sub foo()
Which will write: object to the screen.
anyway hope that helps.
Read this if you want to know how to get a correct reply for your question:
.: Wrox Technical Editor :.
Wrox Books 24 x 7