bindinglist(of T) bound to two controls

R

Rick

VS.net 2005

I'm using a bindinglist(of T) to bind to various controls on a WinForm. I
use the name/value pairs in the "type" for the displayMember and ValueMember
of say a ComboBox control.

For example I might load the TermsNumber and TermsDescription from a
database into the binding list and then use the combobox to feed into a
customer setup form for default terms and for a order setup form for the
individual order terms.

I haven't checked this when the binding list is bound to two different forms
in the same project, however when they I have two comboboxes bound to the
same bindinglist on the same form they always resynch when one is changed.

I want them to act independently. Is this possible? I set the
RaiseLastChangeEvent = False, but this has no effect.

I realize I can create two bindinglists and use them separately, but this
seems like a waste of memory if I could decouple the bindinglist synch.

Any suggestions?

Rick
 
R

RobinS

I recommend that you add 2 binding sources, one for each table, and bind
both of these to one bindinglist. The binding source is a component in the
Data part of the Toolbox, or you can create it programmatically.

Dim myBindingSource as BindingSource = New BindingSource()
Dim myOtherBindingSource as BindingSource = New BindingSource()

myBindingSource.DataSource = myBindingList
myOtherBindingSource.DataSource = myBindingList

myComboBox.DataSource = myBindingSource
(valuemember, displaymember)

myOtherComboBox.DataSource = myOtherBindingSource
(value member, display member)

Robin S.
 

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