What does Static mean in VB?
EDIT – Code sample for reference
Module Module1
Sub Main()
Dim a = New Foo
Dim b = New Foo
Console.WriteLine(a.Boom)
Console.WriteLine(a.Boom)
Console.WriteLine(a.Boom)
Console.WriteLine(b.Boom)
End Sub
End Module
Class Foo
Function Boom() As Integer
Static callCount As Integer = 0
callCount += 1
Return callCount
End Function
End Class
It’s a way of having fields that are local to a method. Basically, the value is maintained between calls but not accessible in other parts of the class. See Static Local Variables in VB.NET for some implementation information.
EDIT: Jonathan, you’re right that the fields don’t have to be Shared/static. If the function/sub is declared Shared, it will be a Shared/static field. Otherwise, it will be a instance field. Either way, it is persistent across calls and local to the method. The below example (to continue a theme) shows both behaviors clearly: