Name
Enum Statement
Syntax
accessmodifierEnumname [As type]membername[=constantexpression]membername[=constantexpression] ... End Enum
-
accessmodifier(optional; Keyword) The possible values of
accessmodifierarePublic,Private,Friend,Protected, orProtectedFriend. For more information, see Section 4.7 in Chapter 4.-
name(required; String literal) The name of the enumerated data type.
-
membername(required; String literal) The name of a member of the enumerated data type.
-
constantexpression(optional; Long) The value to be assigned to
membername.-
type(optional; 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
Enumstatement 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
accessmodifiercan be any one of the following:Public,Private,Protected,Friend, orProtectedFriend. 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 |
All derived classes |
Declaring project |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access