Converting an enumerated value to a string. : Enum « Data Type « VB.Net Tutorial






Imports System

Public Class EnumSample    
    Enum Colors
        Red = 1
        Blue = 2
    End Enum

    Public Shared Sub Main()
        Dim myColors As Colors = Colors.Red
        Console.WriteLine("The value of this instance is '{0}'",myColors.ToString())
    End Sub
End Class








2.20.Enum
2.20.1.Define Enum and assign value
2.20.2.Define and use Enum as Integer
2.20.3.Declare Enum variable
2.20.4.Public Enum type
2.20.5.Assign value to Enum elements
2.20.6.Assign value to only one Enum element
2.20.7.Cast Integer to Enum value
2.20.8.Convert Enum to Integer
2.20.9.Enum value duplication
2.20.10.Compare Enum element using logic operator
2.20.11.Converting an enumerated value to a string.
2.20.12.Standard Enumeration Format Specifiers