Common DataSource gives unexpected behavior with comboboxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I have 2 comboboxes whos datasource is the same datatable I get some unexpected (and unwanted) behavior. When I change the selection in either combobox, the other changes to match it. The behavior probably applies to other controls as well.

I would guess binding is being overly helpful, but I need to know how to disable it.

I've considered just making of copy of my datatable for one of the controls, but I doubt that is the proper solution.
 
That works and I like it better than making a copy of the table, but is this the proper solution. If so, it would mean that whenever there's a possibility of another control using the same datatable, one should DataSource to a Dataview and not directly to the table.
 
bobk said:
That works and I like it better than making a copy of the table, but is
this the proper solution.
Actually using two separate Dataviews isn't going to work here. I think
you're going to have to use two different bindingcontexts... this works such
that two different panels for instance (or other containers) don't need to
share the same bindingcontext. I"ve gotten burned on this before and it
appeared to work using the views, but that was because I was doing to some
other manipulation with the events and it still didn't do what I wanted it
to.

If so, it would mean that whenever there's a possibility of another control
using the same datatable, one should DataSource to a Dataview and not
directly to the table.

As far as what to bind to..it's six of one half dozen of another. It really
depends on what you want to do, but you can bind to either source (or
anything implementing IList)

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
 
http://msdn.microsoft.com/library/d...ystemwindowsformsbindingcontextclasstopic.asp

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
bobk said:
A prototype indicated that the dataview approach worked, so thanks for the
heads-up that a simple case test can be misleading.
Two binding contexts huh? I was afraid that's where this was leading.
How does one implement 2 binding contexts. Are there any good articles in
MSDN on this topic?
 
Back
Top