Riddhi Valecha

Riddhi Valecha

  • 441
  • 3.3k
  • 413.1k

Winforms-Combobox, Listbox and Enums - URGENT

Jun 14 2013 9:14 AM
Hi all...

I need help in Combo Box, List box and Enums in Windows Applications in C#.

My requirement is -

I have an Enum - Colours.
public enum Colours
{
Red=1, Blue, Green, Purple, Brown, Yellow , Black}

I want to bind this enum with combo box in such a way that-
Combo Box  items are - Red, Blue, Green, Purple, Brown, Yellow , Black.
Combo Box Value Member - Index of colours i.e. 1,2,3,5,6,7.
Listbox items are - Red, Blue, Green, Purple, Brown, Yellow , Black.
ListBox selectedValue -Index of colours i.e. 1,2,3,5,6,7.
----------
Scenario-When user selects a colour(say Blue), then value (here 2) should be stored in database.

Please help..

Thanks all in advance



Answers (3)