How to play group of MP3 files continuously

Posted on 2009-04-16
Last Modified: 2012-05-06
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

Question by:jhmblvd
    LVL 83

    Accepted Solution

    You could use the stateChanged event of the control to see if the player is stopped then play the next file.

    Author Closing Comment

    The problem was with my understanding!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    759 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

    11 Experts available now in Live!

    Get 1:1 Help Now