【发布时间】:2014-07-06 23:53:55
【问题描述】:
我有一个两个组合框。我想将第一个组合框中未选择的值动态添加到第二个组合框。
【问题讨论】:
-
那么问题出在哪里? (提示,使用几个临时列表)
-
只使用selection changed事件,获取combo box中的所有item,去掉那些被选中的
标签: c#
我有一个两个组合框。我想将第一个组合框中未选择的值动态添加到第二个组合框。
【问题讨论】:
标签: c#
Dictionary<string, string>test = new Dictionary<string, string>();
test.Add("1", "dfdfdf");
test.Add("2", "dfdfdf");
test.Add("3", "dfdfdf");
comboBox1.DataSource = new BindingSource(test, null);
comboBox1.DisplayMember = "Value";
comboBox1.ValueMember = "Key";
// Get combobox selection (in handler)
string value = ((KeyValuePair<string, string>)comboBox1.SelectedItem).Value;
【讨论】: