How to: Iterate Through An Enumeration in Visual Basic
Enumerations provide a convenient way to work with sets of related constants, and to associate constant values with names. To iterate through an enumeration, you can move it into an array using themethod. You could also iterate through an enumeration using a For...Each statement, using the or GetValues method to extract the string or numeric value.
To iterate through an enumeration
Declare an array and convert the enumeration to it with the GetValues method before passing the array as you would any other variable. The following example displays each member of the enumeration MyEnum as it iterates through the enumeration.