NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Enum Statement

Declares a type for an enumeration.

[Public|Private|Protected|Friend|Protected Friend] Enum name
   membername [= constantexpression]
   membername [= constantexpression]
      . . .
End Enum

The Enum statement has these parts:

Part Description
Public Optional. Entities declared with the Public modifier have public access. There are no restrictions on the use of public entities.
Private Optional. Entities declared with the Private modifier have private access. A private entity is accessible only within its declaration context, including any nested entities.
Protected Optional. Entities declared with the Protected modifier have protected access. Protected access can only be specified on members of types (both regular type members and nested types), although there are different access rules for the two. A protected type member contained in a type is accessible to entities contained in a derived type, provided the access takes place through the derived type. A protected type nested in a type is accessible to entities contained in a derived type, provided the access takes place through the base type (since nested types are not inherited). Protected access is not a superset of friend access.
Friend Optional. Entities declared with the Friend modifier have friend access. An entity with friend access is accessible only within the program that contains the entity declaration.
Protected Friend Optional. Entities declared with the Protected Friend modifiers have the union of protected and friend accessibility.
name Required. The name of the Enum type. The name must be a valid Visual Basic identifier and is specified as the type when declaring variables or parameters of the Enum type.
membername Required. A valid Visual Basic identifier specifying the name by which a constituent element of the Enum type will be known.
constantexpression Optional. Value of the element (evaluates to a Long). If no constantexpression is specified, the value assigned is either zero (if it is the first membername), or 1 greater than the value of the immediately preceding membername.

Remarks

Enumeration variables are variables declared with an Enum type. The elements of the Enum type are initialized to constant values within the Enum statement. The assigned values can't be modified at run time. Values can include both positive and negative numbers. For example:

Enum SecurityLevel
   IllegalEntry = -1
   SecurityLevel1 = 0
   SecurityLevel2 = 1
End Enum

An Enum statement can appear within classes, modules and structures. Once the Enum type is defined, it can be used to declare variables, parameters, or procedures returning its type.

You can't use an Enum type as the target in a With block.

See Also

Example