我需要 5 个 wav 文件在程序结束时随机播放。我知道如何让它播放一首歌,我已经在这个网站上找到了一个代码,但它对我不起作用,它只是每次播放同一首歌。这是代码:
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
然后我将其用作:
PlayRandomTrack()
我究竟做错了什么?