Mondeo Posted August 29, 2007 Posted August 29, 2007 Hi, Got an enumeration which i've iterated through and added its members to a combobox. Dim s As New Nevron.UI.WinForm.Controls.ColorScheme Dim schemes As Array schemes = system.Enum.GetValues(GetType(Nevron.UI.WinForm.Controls.ColorScheme)) Dim scheme As Nevron.UI.WinForm.Controls.ColorScheme For Each scheme In schemes cboPalletteSelect.Items.Add(scheme) Next When the user selects a scheme I need to store the integer value of the enum in my database, but how do I access it? cboPalletteSelect.SelectedItem only returns a string, how to I get the underlying index of the selected enum? Thanks Quote
MrPaul Posted August 30, 2007 Posted August 30, 2007 SelectedIndex and SelectedValue Do you need the selected value's index, or the actual enum value? To retrieve the index you can use the SelectedIndex property. To retrieve the enum value you can use the SelectedValue property, or cast the SelectedItem to an Integer - the item is probably not a string but an instance of the ColorScheme type. Good luck :cool: Quote Never trouble another for what you can do for yourself.
Administrators PlausiblyDamp Posted August 30, 2007 Administrators Posted August 30, 2007 You could always use the System.Enum.Parse method to convert the string back to the Enum and then get it's underlying value. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.