I need 5 wav files to play randomly at the end of my program. I know how to get it to play one song, and I found a code on this site already but it doesn’t work for me, it just plays the same song every time. Here is the code:
Public Sub PlayRandomTrack()
Dim trackNum As Integer = CInt(Rnd() * 5 + 0.5)
Select Case trackNum
Case 1
My.Computer.Audio.Play(My.Resources.CallingMonsters, AudioPlayMode.Background)
Case 2
My.Computer.Audio.Play(My.Resources.McclainSisters, AudioPlayMode.Background)
Case 3
My.Computer.Audio.Play(My.Resources.Mendler, AudioPlayMode.Background)
Case 4
My.Computer.Audio.Play(My.Resources.Pray, AudioPlayMode.Background)
Case Else
My.Computer.Audio.Play(My.Resources.WillowWhip, AudioPlayMode.Background)
End Select
End Sub
and then I use it as:
PlayRandomTrack()
What am I doing wrong?
From MSDN: