I have made a program that loads all the songs on my computer into a listview and plays them at random (at least that is what I want) right now I have them moveing to another list and removeing them from the current list so that none are played twice but I can't figure out where to put the code to make it wait until one song stops before starting the next song. is there a media completed function or something that I'm missing?

P.S. how do I give a person on here credit for help?

I found what I was looking for. here is what I have incase it will help someone else

I have two listview controls on the form and two pictureboxs which act as buttons.
When the program runs it will only display a play or stop button at the top left of the
screen. The first listView is loaded with all the songs from the drive and they are
counted (fileCount). Songs are selected at random from the list and loaded into the media player

Public Sub playMedia()
        If fileCount = 0 Then loadFiles()
        randomSong = i.Next(0, fileCount)
        lviewSongs.Items(randomSong).Selected = True
        songToPlay = lviewSongs.SelectedItems.Item(0).Text
        wmp1.URL = songToPlay
    End Sub

Private Sub wmp1_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles wmp1.PlayStateChange
'I had to add this to make the songs play after the first one 
‘for some reason loading the rest of the songs did not make it play 
        If wmp1.playState = WMPLib.WMPPlayState.wmppsReady Then
            Try 'this loops through all the loading and buffering and such
                wmp1.Ctlcontrols.play()'then when its ready it plays
            Catch ex As Exception
            End Try
        End If
'here is the part where we loop to the next really random song
'when each song is played it is removed from the list so that all of the 
'songs on the drive are played before we hear one again and I save the last 
'5 songs and will compare them before playing the next 5 from the new list to 
‘make sure we didn’t hear a song recently – this gives us a 10 song buffer
        If wmp1.playState = WMPLib.WMPPlayState.wmppsMediaEnded Then
            If fileCount < 6 Then lviewSongsPlayed.Items.Add(songToPlay) : lviewSongsPlayed.Items(0).SubItems.Add(songToPlayFullPath)
            For Each lviewItem As ListViewItem In lviewSongs.SelectedItems
                fileCount = fileCount – 1  
            Next lviewItem
            Exit Sub
        End If
    End Sub
This question has already been answered. Start a new discussion instead.