Solved

Multi-Selction in List Boxes

Posted on 2004-04-17
8
196 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
8 Comments
 
LVL 4

Accepted Solution

by:
learning_t0_pr0gram earned 25 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 25 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

758 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

20 Experts available now in Live!

Get 1:1 Help Now