Name
Enum Statement
Syntax
accessmodifier
Enumname
[Astype
]membername [= constantexpression]
membername [= constantexpression]
... End Enum
-
accessmodifier
Use: Optional
Type: Keyword
The possible values of
accessmodifier
arePublic
,Private
,Friend
,Protected
, orProtected
Friend
. For more information, see Section 3.7 in Chapter 3.-
name
Use: Required
Type: String literal
The name of the enumerated data type.
-
membername
Use: Required
Type: String literal
The name of a member of the enumerated data type.
-
constantexpression
Use: Optional
Data Type: Long
The value to be assigned to
membername
.-
type
Use: Optional
Type: Keyword
The data type of the enumeration. All enumerated members must be integers; possible values are
Byte
,Short
,Integer
, andLong
.
Description
Defines an enumerated data type. All of the values of the data type
are defined by the instances of
membername
.
Rules at a Glance
The
Enum
statement can only appear at module level, in the declarations section of a form, code module, or class module.Access rules for Enums are the same as for variables and constants. In particular, the optional
accessmodifier
can be any one of the following:Public
,Private
,Protected
,Friend
, orProtected
Friend
. The following table describes the effects of the various access modifiers:
Direct access scope |
Class/object access scope | |
---|---|---|
Private |
Declaring class |
Declaring class |
Protected |
All derived classes |
Declaring class |
Friend |
Derived in-project classes |
Declaring project |
Protected Friend |
Get VB .NET Language in a Nutshell 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.