Get String value from a Enum


My New Task

Get String value from a Enum

    Enum TestingEnum As Integer
        A = 0
        B = 1
        C = 2
        D = 3
    End Enum


    Dim Value As TestingEnum

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Value = TestingEnum.B
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

   MsgBox(Value.ToString)  'Simplest of ways


        Dim val As Object
        val = [Enum].GetName(GetType(TestingEnum), Value)
        Msgbox(val) ' Will Return B

    End Sub

Comments

Popular posts from this blog

Shared / Static Class in vb.net/C#

Xamarin Forms : PopUp Page with RG.Plugins.Popup

Text was truncated or one or more characters had no match in the target code page.". (SQL Server Import and Export Wizard)