0

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 .

leppie
  • 115,091
  • 17
  • 196
  • 297

1 Answers1

-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
  • 3
    don'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