Hi,

I am a quite experiences programmer and started coding a vb media player yesterday. Its basically done apart from i cant get the player to automatically load the next song. I have done a search of this forum but none of the previous responses seem to work.

Heres the code :

Private Sub WMP_StatusChange()

If WMP.playState = wmppsMediaEnded Then
If OptOn.Value = True Then
filecount = File1.ListCount
chosenfile = Int(Rnd * filecount) + 1 'generate random index
File1.Selected(chosenfile) = True
filename = Dir1.Path & "\" & File1.filename
WMP.URL = filename
Else
fileindex = File1.ListIndex
fileindex = fileindex + 1
File1.Selected(fileindex) = True 'plays next index
filename = Dir1.Path & "\" & File1.filename
WMP.URL = filename
End If
End If

End Sub

I have tried different events as well like playstatechange but no luck. The very annoying thing is that an identical piece of code works on a button click.

Any response would be appreciated

Thanks in advance

Juggler