Enumerations in Visual Basic

An enumeration is a group of related constants, each of which is given a descriptive name. Each value in an enumeration corresponds to a preset integer.

Example

Module Module1
    Enum abcType
        first
        second
        third
        fourth
    End Enum

    Sub Main()

        Console.WriteLine(abcType.first)
        Console.WriteLine(abcType.second)
        Console.WriteLine(abcType.third)

        Console.ReadLine()
    End Sub

End Module

Output

0
1
2

Share

You may also like...