Weird ComboBox behaviour

M

Marius Horak

I have 5 combo boxes, each has the same ArrayList as DataSource.
When SelectedItem of one combo box changes other combo boxes change
their SelectedItem as well.

There are no events attached to any of the combo boxes.


MH
 
J

Jack Jackson

That is the expected behavior. All comboboxes share one currency
manager.

You need to have different currency managers for each combobox. I'm
not sure the best way to solve this, but one that should work is
(untested code):

Dim bindSource as BindingSource

bindSource = New BindingSource
bindSource.DataSource = myArrayList
combobox1.DataSource = bindSource

bindSource = New BindingSource
bindSource.DataSource = MyArrayList
combobox2.DataSource = bindSource

etc.
 
M

Marius Horak

Jack said:
That is the expected behavior. All comboboxes share one currency
manager.

You need to have different currency managers for each combobox. I'm
not sure the best way to solve this, but one that should work is
(untested code):

Dim bindSource as BindingSource

bindSource = New BindingSource
bindSource.DataSource = myArrayList
combobox1.DataSource = bindSource

bindSource = New BindingSource
bindSource.DataSource = MyArrayList
combobox2.DataSource = bindSource

Thanks. I discovered this 5 minutes after my original post.
And I decided to share my discovery here so I made another post.
And guess what? It got censored and never appeared here.
OK, I used a four letter word, something like "5hit", but this is a
normal word that MS Word accepts.

MH
 
M

Marius Horak

Jack said:
You need to have different currency managers for each combobox. I'm
not sure the best way to solve this, but one that should work is
(untested code):

Dim bindSource as BindingSource

bindSource = New BindingSource
bindSource.DataSource = myArrayList
combobox1.DataSource = bindSource


It works.

MH
 

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