Define and use Enum as Integer : Enum « Data Type « VB.Net Tutorial






Option Strict On

<Flags> Public Enum MyValues As Integer
   AA = 1
   BB = 2
   CC = 4
   DD = 8
End Enum

Public Module modMain
   Public Sub Main()
      Dim Computer1 As MyValues = MyValues.AA Or MyValues.BB
      Console.WriteLine(Computer1.ToString())
   End Sub
End Module
AA, BB








2.20.Enum
2.20.1.Define Enum and assign value
2.20.2.Define and use Enum as Integer
2.20.3.Declare Enum variable
2.20.4.Public Enum type
2.20.5.Assign value to Enum elements
2.20.6.Assign value to only one Enum element
2.20.7.Cast Integer to Enum value
2.20.8.Convert Enum to Integer
2.20.9.Enum value duplication
2.20.10.Compare Enum element using logic operator
2.20.11.Converting an enumerated value to a string.
2.20.12.Standard Enumeration Format Specifiers