Home > Software engineering >  VB to do ActiveX DLL cannot compile Enum
VB to do ActiveX DLL cannot compile Enum

Time:09-18

 
'information type enumerationPublic Enum eumInfoType
Hdmodelsn=0
HdOnlyModel=1
HdOnlySN=2
End Enum

'disk channel enumeration
Public Enum eumDiskNo
HdPrimaryMaster=0
HdPrimarySlave=1
HdSecondaryMaster=2
HdSecondarySlave=3
End Enum

CodePudding user response:


Enum statement



Define an enumerated type,

Syntax

[Public | Private] Enum name

Membername [=constantexpression]

Membername [=constantexpression]

...

End Enum

Enum statement contains the following parts:

Part of the description
Public optional, said the Enum type is visible in the whole project, Enum type of default is Public,
Private optional, said the Enum type being declared in the module is only visible,
Name required, the name of the Enum type, the name must be a valid Visual Basic identifier, in defining the Enum type variable or parameter to specify the type with this name,
Membername required, the Enum type is used to specify the names of the constituent elements of Visual Basic legal identifier,
Constantexpression optional, the value of the element (Long), can be other Enum type, if you don't specify constantexpression, is assigned to the value or 0 (if the element is the first membername), or is greater than its immediate predecessor value 1,


Description

An enumeration variable, is refers to the use Enum type definitions of variables, variables and parameters can be defined as an Enum type, Enum type of element is initialized to Enum constant value specified in the statement, the values can be assigned to include positive and negative, and can not change at run time, for example:

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

Enum statements can only appear in the module level, define Enum type, you can use it to define variables, parameters or return the type of process, can't use the module name to define Enum type, in the class module Public Enum type is not members of the class; But they have also been written to the type library, defined in the standard module of Enum type is not written in the type library, with the same name of the Public cannot Enum type defined in the standard module, and defined in the class module, because they share the same namespace, if different types of libraries, there are two Enum type the name of the same, but different members, is a reference to this type of variable, which will depend on a reference type library has higher priority,

Cannot use Enum type in With block as the target,

CodePudding user response:

reference 1st floor zhao4zhong1 response:

Enum statement




Define an enumerated type,

Syntax

[Public | Private] Enum name

Membername [=constantexpression]

Membername [=constantexpression]

...

End Enum

Enum statement contains the following parts:

Part of the description
Public optional, said the Enum type is visible in the whole project, Enum type of default is Public,
Private optional, said the Enum type being declared in the module is only visible,
Name required, the name of the Enum type, the name must be a valid Visual Basic identifier, in defining the Enum type variable or parameter to specify the type with this name,
Membername required, the Enum type is used to specify the names of the constituent elements of Visual Basic legal identifier,
Constantexpression optional, the value of the element (Long), can be other Enum type, if you don't specify constantexpression, is assigned to the value or 0 (if the element is the first membername), or is greater than its immediate predecessor value 1,


Description

An enumeration variable, is refers to the use Enum type definitions of variables, variables and parameters can be defined as an Enum type, Enum type of element is initialized to Enum constant value specified in the statement, the values can be assigned to include positive and negative, and can not change at run time, for example:

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

Enum statements can only appear in the module level, define Enum type, you can use it to define variables, parameters or return the type of process, can't use the module name to define Enum type, in the class module Public Enum type is not members of the class; But they have also been written to the type library, defined in the standard module of Enum type is not written in the type library, with the same name of the Public cannot Enum type defined in the standard module, and defined in the class module, because they share the same namespace, if different types of libraries, there are two Enum type the name of the same, but different members, is a reference to this type of variable, which will depend on a reference type library has higher priority,

Can't use Enum type as the target, in With block


A big personal, can not directly answer questions of the building Lord, good

The building Lord, from the aspects of access to think about this question, you can use this enumeration method to ensure that all access to the enumeration

You define the enumeration for the Public, if the enumeration is in a private class or form, have you ever been a Public or Public class so as the return value, is wrong,
Other situations to reply,

  • Related