所以这是我的问题:我正在使用两个列表视图创建一个“点唱机”,您双击一个,它将信息添加到另一个列表视图。此外,它将相关的 mp3 信息添加到数组中。Windows Media Player 将使用该数组来连续播放歌曲。
不知何故,我成功地将正确的信息传输到第二个列表视图 (lvTrackList),但是在我双击第二或第三行信息后,第一次双击的相同信息通过 If 语句返回。我的数组开始间隔音轨(例如,添加三首歌曲后,数组表示前两个位置为 0,第三个位置是选择的第一首歌曲)...请帮助!!!
Dim songsArray() As String = {"FurryLewis-BillyLyonsAndStackolee.Mp3", "GusCannon-PoorBoyALongWayFromHome.Mp3", "JoeMcCoy-PileDriverBlues.Mp3", "LouisArmstrong-ComeBack,SweetPapa.mp3"}
Dim queueArray() As String 'Queue for Playlist, containing songnames
Dim queueCount As Integer = 0 'Count for queueArray
'DoubleClick track playlist to add selected track to Queue
Private Sub lvTrackList_DoubleClick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lvTrackList.DoubleClick
intCurrentSong = lvTrackList.SelectedIndices(0)
lvQueueList.Items.Add(lvTrackList.Items(lvTrackList.SelectedIndices(0)).Clone())
'determine applicable mp3 file
currentSong = lvQueueList.Items(0).Text
If currentSong = "Billy Lyons and Stackolee" Then
newSong = songsArray(0)
ElseIf currentSong = "Gus Cannon" Then
newSong = songsArray(1)
ElseIf currentSong = "Kansas Joe McCoy" Then
newSong = songsArray(2)
ElseIf currentSong = "Louis Armstrong" Then
newSong = songsArray(3)
End If
'add file to queueArray for appending to WindowsMediaPlayer playlist
ReDim queueArray(queueCount)
queueArray(queueCount) = newSong
queueCount += 1
End Sub