Basic class containing the enum:
Public Class WeightUnits
Enum ItemWeightUnits
gms = 1
kgs = 2
mls = 3
ltr = 4
End Enum
End Class
An instance of the WeightUnits class is not required as the enum is shared by default.
Loop through the enum and get the NAMES of each entry in the enum.
Dim items As Array
items = System.Enum.GetNames(GetType(WeightUnits.ItemWeightUnits))
Dim item As String
For Each item In items
MsgBox(item)
Next
Loop 1
Loop 2
Loop 3
Loop 4
Loop through the enum and get the VALUES of each entry in the enum.
Dim items As Array
items = System.Enum.GetValues(GetType(WeightUnits.ItemWeightUnits))
Dim item As String
For Each item In items
MsgBox(item)
Next
Loop 1
Loop 2
Loop 3
Loop 4
No comments:
Post a Comment