|
-
Jul 18th, 2006, 06:31 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Select same item in two ListBoxes simultaneously
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.
-
Jul 18th, 2006, 06:33 PM
#2
Re: Select same item in two ListBoxes simultaneously
is it in the same position? If so,
VB Code:
Private Sub List1_Click()
List2.ListIndex = List1.ListIndex
End Sub
-
Jul 18th, 2006, 07:26 PM
#3
Re: Select same item in two ListBoxes simultaneously
That will work, but have you considered using a ListView with two columns instead?
-
Jul 18th, 2006, 08:42 PM
#4
Re: Select same item in two ListBoxes simultaneously
 Originally Posted by bushmobile
is it in the same position? If so,
VB Code:
Private Sub List1_Click()
List2.ListIndex = List1.ListIndex
End Sub
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).
Best way to search second list for matching item and then highlight it. Forum has plenty of samples.
-
Jul 18th, 2006, 08:43 PM
#5
Re: Select same item in two ListBoxes simultaneously
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.
-
Jul 18th, 2006, 08:45 PM
#6
Re: Select same item in two ListBoxes simultaneously
That's why I said: "If items are not in the same position...".
-
Jul 18th, 2006, 08:47 PM
#7
Re: Select same item in two ListBoxes simultaneously
you edited your post! Now mine looks silly.
-
Jul 18th, 2006, 08:49 PM
#8
Thread Starter
Frenzied Member
Re: Select same item in two ListBoxes simultaneously
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|