Dim bEnum As PayTypes = CType(Me.cbxpaytypes.SelectedValue, PayTypes) Select Case bEnum Case PayTypes.Cash MessageBox.Show("You selected cash") Case PayTypes.Check MessageBox.Show(String.Format("You selected {0}", MicroFour.StrataFrame.Tools.Common.GetEnumDisplayValue(bEnum))) Case PayTypes.Other MessageBox.Show("You selected Other") End Select
Me.cbxpaytypes.SelectedValue.ToString
Public Enum PayTypes As Integer <EnumDisplayValue("Cash Payment")> Cash = 1 <EnumDisplayValue("Check Payment")> Check = 2 <EnumDisplayValue("Other Type of Payment")> Other = 3 End EnumThe EnumDisplayValue attribute will require you to Import the MicroFour.StrataFrame.Tools class and also give controlof being able to display values with spaces in your enumerations, very nice and useful feature.