Name
Public Statement
Synopsis
[Overrides] [Shadows] Public [WithEvents] _varname
[([subscripts
])] [As [New]type
] [, [WithEvents] _varname
[([subscripts
])] [As [New]type
]] ...
Overrides
optional; KeywordIn a derived class definition, indicates that a variable overrides a similar variable in a base class
Shadows
optional; KeywordIn a derived class definition, indicates that calls to derived class members that are made through a base class ignore the shadowed implementation
WithEvents
optional; KeywordA keyword that denotes the object variable,
varname
, can respond to events triggered from within the object to which it refersvarname
required; String literalThe name of the variable, which must follow Visual Basic naming conventions
subscripts
optional; Numeric constant or literalDenotes
varname
as an array and specifies the dimensions and number of elements of the arrayNew
optional; KeywordUsed to automatically create an instance of the object referred to by the
varname
object variabletype
optionalData type of the variable
varname
Description
Used at module level to declare a public variable and allocate the relevant storage space in memory.
A Public variable has both project-level scope—that is, it can be used by all procedures in all modules in the project—and, when used in a Class module, it can have scope outside the project.
The Public
keyword also applies to procedures and
class modules.
The behavior of a Public variable depends on where it is declared, as the following table ...
Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.