Give a ComboBox a Key/Value Pair
Posted on 2007-10-04
I'm working in .NET 1.1, and trying to figure out how to assign combox items a key/value pair.
in the combobox, i need to display a list of options with a key behind each value displayed.
"Apple" - 0
"Orange" - 3
"Grapes" - 5
i tried something like cboGrocery.Items.Add(new DictionaryEntry("Apple", "0")), but the combobox will only shows the object Type in the drop down (i.e. "System.Collections.DictionaryEntry").
i understand the combo box of .NET 1.1 doesn't comes with the key/value features, so i'm looking for a simple custom solutions. Please keep in mind that i'm developing in .NET 1.1 C#.