Winforms-Combobox, Listbox and Enums - URGENT
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)
0
None of those functions are anything to do with ASP.NET as such though they can be called from it (using the Platform Invoke mechanism in the case of the first two).
Briefly:
* LoadLibrary is an unmanaged function which loads a dll into a process's address space.
* CoCreateInstance is an unmanaged funmction which creates a COM object using its Class Id (CLSID).
* CreateObject is a VB library function which creates a COM object using its Program Id (ProgID).
* Assembly.Load is a .NET method which loads an assembly at runtime.