Comboboxes are linked for some reason

New much improved solution:

A DataSource is more than just the data.

There is hidden default BindingSource that makes the ComboBoxes follow.

To avoid this coupling and also the data replication in the first version of this answer, all you need to do is create a separate BindingSource for each ComboBox. These share the DataTable but have each its own rowPointer:

BindingSource bS1, bS2, bS3;
..
..    
..
..    
dt = new DataTable();
dt.Load(reader);

bS1 = new BindingSource();
bS1.DataSource = dt; 
bS2 = new BindingSource();
bS2.DataSource = dt; 
bS3 = new BindingSource();
bS3.DataSource = dt;
..
ddl1.DataSource = bS1 ;
ddl2.DataSource = bS2 ;
ddl3.DataSource = bS3 ;
..
..

Now the ComboBoxes can be changed independently.

Note: My first version worked but was the wrong way do it. Sorry..!

Leave a Comment