Skip to content

Instantly share code, notes, and snippets.

@feliperomero3
Last active October 21, 2016 14:21
Show Gist options
  • Save feliperomero3/efbabc4c949f5f934f33699596f7dc82 to your computer and use it in GitHub Desktop.
Save feliperomero3/efbabc4c949f5f934f33699596f7dc82 to your computer and use it in GitHub Desktop.
How to use Enums in VB.Net
Imports System
Public Enum flavorEnum
salty
sweet
sour
bitter
End Enum
Public Module Module1
Public Sub Main()
Dim isEqual As Boolean = False
Dim flavors As String() = {"salty","sweet","sour","bitter"}
Dim index As Integer
Console.WriteLine("The strings in the flavorEnum are:")
Dim i As String
For Each i In [Enum].GetNames(GetType(flavorEnum))
Console.WriteLine(String.Format("{0} equals {1}: {2}", i, flavors(index), i = flavors(index)))
'Console.WriteLine(i)
index = index + 1
Next
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment