Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > several combo box
 

several combo box

i'm use 3 combobox databounded in my form.
when change selected item in one combobox other combobox was change like first combobox.


.net 2
visual studio 2008 9.0.210
Ali Reza Salimzadeh  Thursday, July 16, 2009 6:55 PM
The recommended way to avoid this is to use BindingSource objects.

The BindingSource acts as an intermediary between your control and the actual data object (such as a DataTable). Each BindingSource tracks a current record, so you need 3 BindingSources, one for each ComboBox. Bind each ComboBox to a BindingSource and bind all of the BindingSources to the same object (DataTable, BindingList, etc.).
BinaryCoder  Thursday, July 16, 2009 10:26 PM

Or, use copies of the DataTable, end result is the same (assuming that your DataSource is a DataTable and not some other kind of object).

cboOne.DataSource = MyDataTable.Copy();
cboTwo.DataSource = MyDataTable.Copy();
cboThree.DataSource = MyDataTable.Copy();


~~Bonnie Berent [C# MVP]
BonnieB  Sunday, July 19, 2009 6:14 PM
The recommended way to avoid this is to use BindingSource objects.

The BindingSource acts as an intermediary between your control and the actual data object (such as a DataTable). Each BindingSource tracks a current record, so you need 3 BindingSources, one for each ComboBox. Bind each ComboBox to a BindingSource and bind all of the BindingSources to the same object (DataTable, BindingList, etc.).
BinaryCoder  Thursday, July 16, 2009 10:26 PM

Or, use copies of the DataTable, end result is the same (assuming that your DataSource is a DataTable and not some other kind of object).

cboOne.DataSource = MyDataTable.Copy();
cboTwo.DataSource = MyDataTable.Copy();
cboThree.DataSource = MyDataTable.Copy();


~~Bonnie Berent [C# MVP]
BonnieB  Sunday, July 19, 2009 6:14 PM

You can use google to search for other answers

Custom Search

More Threads

• How Make a column in a DataGridView as dateTimePiker
• Refresh Data in DataGridView
• Scroll the datagrid to a particular row
• Object as DataSource && DataGridView
• Textbox Binding
• Check box in datagrid.
• License code / register code / key code
• How to duplicate records within the same table?
• I am having update trouble
• handle my tool tips