471,605 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

multiple comboBox one array datasource. help...


I have an array of a custom obj which I am trying
to use in multiple comboBoxes without creating multiple
copies, but if I put the datasource of the comboboxes to
the same array, then at runtime if I pick change a combobox,
all of them change to that value. I am guessing that it is
because all the comboboxes are using the same Ilist interface,
and the behind-the-sceens variables.

Now, I could create my own wrapper class to wrap the
array, but I was hoping that there was already one hiding
in plan sight in the frameworks.

Thanks in advance for all help on the issue.
Feb 16 '06 #1
1 2601
Hi,

"TheMadHatter" <Th**********@discussions.microsoft.com> wrote in message
news:2E**********************************@microsof t.com...

I have an array of a custom obj which I am trying
to use in multiple comboBoxes without creating multiple
copies, but if I put the datasource of the comboboxes to
the same array, then at runtime if I pick change a combobox,
all of them change to that value. I am guessing that it is
because all the comboboxes are using the same Ilist interface,
and the behind-the-sceens variables.

Now, I could create my own wrapper class to wrap the
array, but I was hoping that there was already one hiding
in plan sight in the frameworks.

If the two ComboBoxes SelectedValue isn't bound to a common table, list or
object then you can set a different BindingContext for each ComboBox:

comboBox1.BindingContext = new BindingContext();
comboBox2.BindingContext = new BindingContext();

But you could also use a wrapper (like you mentioned). I don't think there
anyhing available in NET1.1, but you could create one yourself (eg. based on
IListSource to keep it simple).

In NET2.0 you just put a different BindingSource between the List and the
ComboBox.

HTH,
Greetings

Thanks in advance for all help on the issue.

Feb 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bob | last post: by
9 posts views Thread by Bob | last post: by
1 post views Thread by Bob | last post: by
2 posts views Thread by AMDRIT | last post: by
5 posts views Thread by Peter M. | last post: by
2 posts views Thread by Matt | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.