Help - Problem with 2 combo boxes populated from same data

G

Greg Bradburn

Greetings,

I have a form with two comboboxes that I want to be populated with the
same values from a table (i.e. both comboboxes have the same
table/column as their datasource and display member).

The selections made from these comboboses are to be saved in two
different columns in another table.

For example, the possible selections could be from the "Description"
column of table a but the selection made from combobox1 would be bound
to the id1 column of table b and the selection made from combobox2
would be bound to the id2 column of table b.

The problem I am having is that any selection made in one combobox is
immediately reflected in the second one. They are staying synchronized
so they both show the same selection.

How can I achieve my desired results?

I thought that by each combobox control having a different
selectedvalue or valuemember property value they would behave
independently.

Any help will be greatly appreciated,

Greg.
 
B

Bram

Hi,

when you bind a control to a datasource (or any other list of objects) a
CurrencyManager
is created to track the current row (or object). Every change of selection
is communicated
to the currency manager, which in turn notifies any other control bound to
the dataset.
So, selection changed in one control is immediately reflected in the other
controls.
Nothing (I guess) you can do about it.
To work around, you could create a second identical dataset (or whatever
list you are using)
and bind this one to the second combobox.
Tip: also wait for other people to reply.

Greetings,

Bram.
 
G

Greg Bradburn

Thanks Bran, that's pretty much the conclusion I've come to as well.

Bram said:
Hi,

when you bind a control to a datasource (or any other list of objects) a
CurrencyManager
is created to track the current row (or object). Every change of selection
is communicated
to the currency manager, which in turn notifies any other control bound to
the dataset.
So, selection changed in one control is immediately reflected in the other
controls.
Nothing (I guess) you can do about it.
To work around, you could create a second identical dataset (or whatever
list you are using)
and bind this one to the second combobox.
Tip: also wait for other people to reply.

Greetings,

Bram.
<snip>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top