How to play group of MP3 files continuously

Hi, I'm trying to get a group of MP3 files to play one after the other, using Visual Basic 2008.

I have the songs in a folder, I can load and play them one at a time, or I can load a playlist but I'm having trouble getting the player to recognize when one song ends, it just stops at the end of the song. How do you get the player to recognize that one song has ended and play the next song in the listbox? I have tried using a loop through the index of the listbox, but again when the song reaches an end it stops and you have to load the next song yourself.

Private Sub btnPlayAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlayAll.Click
Me.tmrPlay.Enabled = True
If Me.AxWindowsMediaPlayer1.Ctlcontrols.currentPositionString >= Me.AxWindowsMediaPlayer1.currentMedia.durationString.TrimEnd Then
intPos = intPos + 1
If intPos > intMax Then
intPos = 1
End If
End If
Fill_Screen() '' reads array to text boxes on the form.
Me.AxWindowsMediaPlayer1.URL = Trim(strData(4, intPos)) 'Play the currently selected song
End Sub

Open in new window

Who is Participating?
You could use the stateChanged event of the control to see if the player is stopped then play the next file.
jhmblvdAuthor Commented:
The problem was with my understanding!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.