Solved

listboxes share data source need to allow separate selected item

Posted on 2009-04-01
3
188 Views
Last Modified: 2013-11-26
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

0
Comment
Question by:Corey2
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 24039686
What type of object does VarManager.RuntimeVarNames return? You may need to clone what ever it is that it returns and use that as your datasource.
0
 
LVL 13

Author Comment

by:Corey2
ID: 24039753
It is a bindintlist (of string)

If I clone it and the underlying list changes will I need to re-clone it?
0
 
LVL 13

Author Closing Comment

by:Corey2
ID: 31565320
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.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now