The concept you are missing, is that in winforms.. you put Objects into the
combobox.
(I know this, because I didn't get it at first either)
You add objects... like
combobox.Items.Add(new Emp("Smith","John");
You can override the ToString() method..
Or you set which property you want to show up as text.
...
When you pull the selected item, you cast it back to the type of object you
put in there.
Emp ep = myComboBox.SelectedItem as Emp;
if (null!=ep)
{
// do stuff with ep
}
"RR" <RR@discussions.microsoft.com> wrote in message
news:5A**********************************@microsof t.com...
Hello,
I'm simply trying to add items with values to a combox at runtime in a
windows application. The code below does not work in windows development.
comboBox.Items.Add(new ListItem("text", value));
How can I do this in win forms?
Thanks!