Link to home
Start Free TrialLog in
Avatar of Corey Scheich
Corey ScheichFlag for United States of America

asked on

listboxes share data source need to allow separate selected item

I have a Binding List that can  change dynamically.  The Binding List then populates 2 listboxes on a form.  The selected index of each is Databound to a different property.  The problem is that when I select an Item in one listbox it appears it is setting the position on the underlying list and causing the other to assume the same value.  How can I separate the selected item while maintaining binding to the source?  I tried using 2 binding sources but got the same problem.
Dim BS1 As New Windows.Forms.BindingSource
           Dim BS2 As New Windows.Forms.BindingSource
 
            BS1.DataSource = VarManager.RuntimeVarNames
            BS2.DataSource = VarManager.RuntimeVarNames
 
            'Link the list of variables to the Listbox
            Me.ListBox_Variables.DataSource = BS1
            Me.ListBox_Variables2.DataSource = BS1

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Corey Scheich

ASKER

It is a bindintlist (of string)

If I clone it and the underlying list changes will I need to re-clone it?
I was hoping for more information.  I ended up copying the data to a new collection for every control I needed the list in and handling the changed event on the original to synchronize the lists.