multipul listbox selection

hillo10
hillo10 used Ask the Experts™
on
hi, i'm stuck on a listbox event, i need to be able to select 3 listboxs at the same time.

to select 2 at the same time i use..

If List1.Selected(List1.ListIndex) = True Then
List2.Selected(List1.ListIndex) = True
ElseIf List1.Selected(List1.ListIndex) = False Then
List2.Selected(List1.ListIndex) = False

how would i go about adding a 3rd listbox so that gets selected too?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Why not expand it:

If List1.Selected(List1.ListIndex) = True Then
List2.Selected(List1.ListIndex) = True
List3.Selected(List1.ListIndex) = True

ElseIf List1.Selected(List1.ListIndex) = False Then
List2.Selected(List1.ListIndex) = False
List3.Selected(List1.ListIndex) = False

endif

Author

Commented:
i have tried that, and for some reason it doesn't select the 3rd listbox, i know this because i've set it to display in a textbox, yet no joy
The suggestion above works just fine for me!?  You need to list the code where you include the 3rd listbox.

Commented:
Are you putting all of your code on one line?  I don't see the end-if which indicates that yours may not be working like mine.  Try putting each line on a separate code line without and line continuation markers.

Author

Commented:
i have tried that, and for some reason it doesn't select the 3rd listbox, i know this because i've set it to display in a textbox, yet no joy

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial