ComboBox DataBinding Weirdness
If I have an array of Customer objects and I bind it to multiple comboBoxes, why does changing one combobox affect the others?
e.g.
Customers[] customerArray = GetCustomers();
comboBox1.DisplayMember = "CustomerName";
comboBox1.ValueMember = "CustomerCode";
comboBox1.DataSource = customerArray;
comboBox2.DisplayMember = "CustomerName";
comboBox2.ValueMember = "CustomerCode";
comboBox2.DataSource = customerArray;
I have found that cloneing the array, removes this issue, but it is not a perfect solution, especially if the array is large.
e.g.
comboBox2.DataSource = customerArray.Clone()