O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Sub Statement

Syntax

[ClassBehavior] [AccessModifier] Sub name [(arglist)] 
   [statements]
   [Exit Sub] 
   [statements]
End Sub
ClassBehavior (optional; Keyword)

One of the keywords shown in the following table:

Keyword

Description

Overloads

Indicates that more than one declaration of this subroutine exists (with different argument signatures).

Overrides

For derived classes, indicates that the subroutine overrides the subroutine by the same name (and argument signature) in the base class.

Overridable

Indicates that the subroutine can be overridden in a derived class.

NotOverridable

Indicates that the subroutine cannot be overridden in a derived class.

MustOverride

Indicates that the subroutine must be overridden in a derived class.

Shadows

In a derived class definition, indicates that calls to derived class members that are made through a base class ignore the shadowed implementation.

Shared

Callable without creating an object of the class. It is, in this strange sense, shared by all objects of the class. These are also called static subroutines.

AccessModifier (optional)

The possible values of AccessModifier are Public, Private, Friend, Protected, or Protected Friend. The following table describes the effects of the various access modifiers. Note that “direct access” refers to accessing the member without any qualification, as in:

classvariable = 100

and “class/object access” refers to accessing the member through qualification, either with the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required