Solved

Multi-Selction in List Boxes

Posted on 2004-04-17
8
198 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
message box in access 4 46
Access 2013 combo box not working 3 44
Spell Check in VB6 13 114
IF ELSE Statement in Excel Macro VBA 16 65
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 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