Windows Combobox Controls that share the same DataSource
We have a states Datatable (50 US States) that has 2 DataColumns, 'code', which equals the state abbreviation, and 'codedesc', which equals the state full name. We retrieve the data for the DataTable from SQL Server at app start-up and cache it for later use.
We have 4 combobox controls on one form that all need to display states. So, we share the cached states DataTable as their DataSource. We also databind the control's SelectedValue property to another datasource.
Databinding cannot keep the states in synch for some reason when sharing the cached states DataSource. Navigation display all kinds of different states in the 4 controls, but never the correct ones.
So, we call copy on the cached states DataTable 3 times, meaning we now have 4 states DataTables (the original plus 3 copies) . We then set states1 combobox to the original Datatable, states2 to copy1, states3 to copy2 and states4 to copy3. DataBinding is now happy and everything is in synch. The only difference is the combobox controls no longer share, or use, the same DataSource. They use a unique DataSource where the DataSource is identical.
Can anyone explain why sharing a DataSource for an IList control does not work when DataBinding?