dembel, первое что в голову пришло, добавлять в комбобокс свои объекты
| Код | using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace WindowsFormsApplication1 { class SomeItem { public string Caption { set; get; } public string Info { set; get; }
public SomeItem(string pCaption, string pInfo) { this.Caption = pCaption; this.Info = pInfo; }
public override string ToString() { return this.Caption; } } }
|
| Код | private void button1_Click_2(object sender, EventArgs e) { comboBox1.Items.Add(new SomeItem("Hello", "SomeInfo_1")); comboBox1.Items.Add(new SomeItem("World", "SomeInfo_2")); comboBox1.Items.Add(new SomeItem("Man", "SomeInfo_3")); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.Items != null) { SomeItem currentItem = (SomeItem)comboBox1.SelectedItem; textBox1.Text = currentItem.Info; } }
|
|