Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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:

Never trouble another for what you can do for yourself.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...