class Option
{
public string Key { get; set; }
public string Value { get; set; }
public Option(string pKey, string pValue)
{
this.Key = pKey;
this.Value = pValue;
}
}
设置
Option option = new Option("1", "金额");
this.combobox1.Items.Add(option );
// 在此可以增加N个
this.combobox1.Items.Add(option );
// 对应 ListItem 的 Value 显示值
this.combobox1.DisplayMember = "Value";
// 对应 ListItem 的 Key 隐藏值
this.combobox1.ValueMember = "Key";
读取
Option option = (Option )comboBox1.SelectedItem;
MessageBox.Show(option .Key + option .Value);