?
Solved

Multi-Selction in List Boxes

Posted on 2004-04-17
8
Medium Priority
?
206 Views
Last Modified: 2010-05-02
Ok, I am making a program for playing music.  When the user selects the song it goes into the list box as a string and so on as they choose more songs.  I want them to be able to select several songs and they can choose the next one or the previous.  It only plays the last song the user clicks on.  My code is-
Command2_click
Dim song as string
song= List1.text
MMcontrol1.filename= song
MMcontrol1.command="open"
MMcontrol1.command="Load"
End Sub

Im a bit of a noob so it might be simple:P. Thanks
0
Comment
Question by:Phantom61
  • 4
5 Comments
 
LVL 4

Accepted Solution

by:
learning_t0_pr0gram earned 100 total points
ID: 10850610
set the MultiSelection property to "Extended".. then hold control to select more than one song
0
 
LVL 15

Expert Comment

by:unknown_routine
ID: 10850817
Hi,

Use this:

Dim i
Dim song as string

For i = 0 To List1.ListCount - 1
If List1.Selected(i) Then
  song=List1.List(i)
  MMcontrol1.filename= song
  MMcontrol1.command="open"
  MMcontrol1.command="Load"
end if
Next i


End If

Next i
0
 
LVL 15

Assisted Solution

by:unknown_routine
unknown_routine earned 100 total points
ID: 10850820

remove extra

End If

Next i

in the code above


so code is :

Dim i
Dim song as string

For i = 0 To List1.ListCount - 1
If List1.Selected(i) Then
  song=List1.List(i)
  MMcontrol1.filename= song
  MMcontrol1.command="open"
  MMcontrol1.command="Load"
End if
Next i


0
 
LVL 15

Expert Comment

by:unknown_routine
ID: 10850828
By the way ,

to make user able to select multi items, change the multiselect property of
the listbox to Simple.
0
 
LVL 15

Expert Comment

by:unknown_routine
ID: 11259215
I supplied complete answer for this question.

An split seems proper with 80% for  unknown_routine and 20% for learning_t0_pr0gram.
 


0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

850 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