Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleEasily list the values defined by an Enum in Visual Basic .NET
DescriptionThis example shows how to easily list the values defined by an Enum in Visual Basic .NET
KeywordsEnum, list values, enumerated values, GetValues, VB.NET
CategoriesVB.NET, Software Engineering, Tips and Tricks
 
The Enum class is the base class for enumerations. It has a GetValues method that returns an array of values defined by an enumerated type. The following code loops through the array and adds the name of each value to a ListBox.
 
For Each hatch_style As HatchStyle In _
    [Enum].GetValues(GetType(HatchStyle))
    lstHatchStyles.Items.Add(hatch_style.ToString)
Next hatch_style
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated