I am having a two combo box .I want to add the values which are not selected in the 1st combo box to the 2nd combo box dynamically .
Asked
Active
Viewed 1,886 times
0
-
so what's the problem? (hint, use a couple of temp lists) – Noctis May 19 '14 at 06:10
-
just use the selection changed event, get all the items in the combo box, and remove those that are selected – Sayse May 19 '14 at 06:22
1 Answers
-1
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;

amin
- 1,194
- 1
- 12
- 20
-
This doesn't answer the question, and it removes any object attached to the list item – Sayse May 19 '14 at 06:21
-
3don't just copy and past the code rather then put the link http://stackoverflow.com/questions/3063320/combobox-adding-text-and-value-to-an-item-no-binding-source – Dhaval Patel May 19 '14 at 06:22