>class MyComboBoxItem >{ > public MyComboBoxItem(string Text) > { > text = Text; > itemData = 0; > } > > public MyComboBoxItem(string Text, int ItemData) > { > text = Text; > itemData = ItemData; > } > > public int ItemData > { > get > { > return itemData; > } > set > { > itemData = value; > } > } > > public override string ToString() > { > return text; > } > > protected string text; > protected int itemData; >} >>
>comboBox1.Items.Add(new MyComboBoxItem("My text", 12)); >>
> MyComboBoxItem mci = (MyComboBoxItem)comboBox1.SelectedItem;
> MessageBox.Show(mci.ItemData.ToString());
>