0

i bind some data at two different combobox like this:

BindingList<Customer> customers = new BindingList<Customer>();
customer.Add(new Customer(1, "Mike"));
customer.Add(new Customer(2, "Max"));
customer.Add(new Customer(3, "Taylor"));

combobox1.DisplayMember = "Name";
combobox1.ValueMember = "Id";
combobox1.DataSource = customers;

combobox2.DisplayMember = "Name";
combobox2.ValueMember = "Id";
combobox2.DataSource = customers;

It's working good, but if i selecting some item in combobox1 this item automatically select in combobox2. How to resolve this problem (need independent choice) ?

1 Answers1

1

The following code does work seamlessly for me:

BindingList<Customer> customer = new BindingList<Customer>();
customer.Add(new Customer(1, "Mike"));
customer.Add(new Customer(2, "Max"));
customer.Add(new Customer(3, "Taylor"));

BindingList<Customer> customer2 = new BindingList<Customer>(customer);

combobox1.DisplayMember = "Name";
combobox1.ValueMember = "Id";
combobox1.DataSource = customer;

combobox2.DisplayMember = "Name";
combobox2.ValueMember = "Id";
combobox2.DataSource = customer2;
cramopy
  • 3,459
  • 6
  • 28
  • 42