Visual Studio / C#

  • Thread starter Thread starter nbohana
  • Start date Start date
N

nbohana

I am developing a windows application. On one screen I have 6 ComboBox's each
displaying the same information from the same sql database table, except the
information can be a different name. Excample ' supplier1, supplier2....). My
problem is when I change one they all change, how can I fix this problem?
Please help and thanks in advance.
 
I am developing a windows application. On one screen I have 6 ComboBox's
each
displaying the same information from the same sql database table, except
the
information can be a different name. Excample ' supplier1, supplier2....).
My
problem is when I change one they all change, how can I fix this problem?
Please help and thanks in advance.

Don't set the DataSource to the same object. Whatever object you're using as
the source of data must be cloned (copied) so that each combo box uses a
different source. Otherwise they all synchronize on the same entry. It
surprised me the first time, too.
 
nbohana said:
I am developing a windows application. On one screen I have 6 ComboBox's each
displaying the same information from the same sql database table, except the
information can be a different name. Excample ' supplier1, supplier2....). My
problem is when I change one they all change, how can I fix this problem?
Please help and thanks in advance.
Just create and assign a separate BindingContext object to each combo
box's BindingContext
 
Jeff said:
Don't set the DataSource to the same object. Whatever object you're using as
the source of data must be cloned (copied) so that each combo box uses a
different source. Otherwise they all synchronize on the same entry. It
surprised me the first time, too.
No offense, but this is not the solution! If you are doing this, you too
need to change all your code :(
 
Ashutosh said:
Just create and assign a separate BindingContext object to each combo
box's BindingContext
I am not sure if it's BindingContext or the BindingNavigator....I used
them long time back and I guess it's BindingNavigator only!!
 
I am developing a windows application. On one screen I have 6 ComboBox's
each displaying the same information from the same sql database table,
except
the information can be a different name. Excample ' supplier1,
supplier2....).
My problem is when I change one they all change, how can I fix this
problem?
Please help and thanks in advance.
Don't set the DataSource to the same object. Whatever object you're using
as
the source of data must be cloned (copied) so that each combo box uses a
different source. Otherwise they all synchronize on the same entry. It
surprised me the first time, too.
No offense, but this is not the solution! If you are doing this, you too
need to change all your code :(

Probably. I personally despise the concept of data binding to begin with.
 
I am developing a windows application. On one screen I have 6 ComboBox's
each displaying the same information from the same sql database table,
except the information can be a different name. Excample ' supplier1,
supplier2....). My problem is when I change one they all change, how can
I fix this problem? Please help and thanks in advance.

I created two binding sources assigned them to the same data items, in
this case it is a parent child relationship

BindingSource HomeSource = new BindingSource();
HomeSource.DataSource = MyDB.CompetitionBindingSource;
HomeSource.DataMember = "FK_Competition_Team";
AwaySource.DataSource = MyDB.CompetitionBindingSource;
AwaySource.DataMember = "FK_Competition_Team";

I then attached them to the combo box.
 
Back
Top