datatable
-
Several combo boxes on the UI winform are populated using a DataTable. ie. dtUsers dtUsers is a table in a dataset. Several combo boxes are populated using this datatable. Not sure why when an item in one of the combo boxes is selected, then all the other combo boxes get changed too. This is a sample of how the combo boxes are populated: dtUsers = dsUsers.Tables["Users"]; cbo1.DataSource = dtUsers; cbo1.DisplayMember = "Name"; cbo1.ValueMember = "UserID";
-
Several combo boxes on the UI winform are populated using a DataTable. ie. dtUsers dtUsers is a table in a dataset. Several combo boxes are populated using this datatable. Not sure why when an item in one of the combo boxes is selected, then all the other combo boxes get changed too. This is a sample of how the combo boxes are populated: dtUsers = dsUsers.Tables["Users"]; cbo1.DataSource = dtUsers; cbo1.DisplayMember = "Name"; cbo1.ValueMember = "UserID";
-
Several combo boxes on the UI winform are populated using a DataTable. ie. dtUsers dtUsers is a table in a dataset. Several combo boxes are populated using this datatable. Not sure why when an item in one of the combo boxes is selected, then all the other combo boxes get changed too. This is a sample of how the combo boxes are populated: dtUsers = dsUsers.Tables["Users"]; cbo1.DataSource = dtUsers; cbo1.DisplayMember = "Name"; cbo1.ValueMember = "UserID";
I assume of course that in cbo2 you give the DisplayMember a different value, right? Try to make a break point to see if this value applies or not. Anyway, I've been working with ADO .Net and databindings for quite a while now, and let me tell you I'm completely displeased with it. It has many bugs, and what would Microsoft would call "features" that costed me a lot of time to discover it. When I submitted somehting to them all they said was "Make your own workaround. We don't have the time to fix this in the next version of Visual Studio. Thank you!", and that's it. Anyway. A good way -that works for me- is to use a BindingSource and bind it to your controls using cbo1.DataBindings.Add() method. It works fine fr the Text property -but not with CheckBox.Checked property BTW-. A sample would be
BindingSource UsersSource = new BindingSource();
UsersSource.DataSource = dsUsers.Tables["Users"];
cbo1.DataBindings.Add(new Binding("SelectedItem", UsersSource, "Name"));
cbo1.DataBindings.Add(new Binding("SelectedValue", UsersSource, "UseID"));I hope it works for you!:) -- modified at 6:55 Thursday 4th January, 2007 The above code I use for a DropDownList combobox. You can also bind to the Text property according to your need.
Regards:rose: