Hi, I have two ListBoxes with exactly the same items.
If I click on an item in ListBox 1 and highlight it, can also the exact same item in ListBox 2 be selected/highlighted at the same time?
Thanks.
Printable View
Hi, I have two ListBoxes with exactly the same items.
If I click on an item in ListBox 1 and highlight it, can also the exact same item in ListBox 2 be selected/highlighted at the same time?
Thanks.
is it in the same position? If so,VB Code:
Private Sub List1_Click() List2.ListIndex = List1.ListIndex End Sub
That will work, but have you considered using a ListView with two columns instead?
If items are not in the same position then that will not work (if one list is sorted and second is not OR both lists were populated in some random order).Quote:
Originally Posted by bushmobile
Best way to search second list for matching item and then highlight it. Forum has plenty of samples.
i did ask "is it in the same position" - if it is then that's the easiest way, if not then sure you'll have to search the list.
That's why I said: "If items are not in the same position...". :)
you edited your post! Now mine looks silly.
Thank you bushmobile. I already tried that before and now I see I had put it in the wrong part of the MouseDown event...
Everything is working fine now :)
MartinLiss, I'm using a TabStrip with hiding/showing various Frames, so both ListBoxes in the Frames are not visible at the same time. The first Listbox is used to drop files into and the second one is later used to work with the files. When an item is deleted from ListBox1 or moved up/down, then the same thing has to happen in ListBox2. That's why I'm using two ListBoxes instead of a Listview.