VB中Windows Media Player如何读取text1.text中的数据

Text1.text中的数据是多行的音乐地址,我想要点击一下按钮,然后让Windows Media Player插件开始读取Text1.text的第一行音乐地址,播放完毕后,再读取第二行的地址播放。这个该如何做到呢?

定义一个Integer成员变量,写在方法外面,代表当前是第几行
Private currLineNum As Integer = 0
给WindowsMediaPlayer添加PlayStateChange事件
编写如下代码:
If e.newState = 8 Then '播放完了
currLineNum += 1
If currLineNum > textBox.ines.Count() - 1 Then currLineNum = 0
End If
Dim path = textBox1.Lines(currLineNum) As String
下面就是你的播放代码,Path就是要播放的歌曲地址

VB6?

VB6代码略为修改
Private currLineNum As Integer

If e.newState = 8 Then '播放完了
currLineNum =currLineNum + 1
If currLineNum > UBound(Split(text1.Text, VbCrLf)) Then currLineNum = 0
End If
Dim path As String
path = Split(text1.Text, VbCrLf)(currLineNum)

需要处理Windows Media Player插件的事件吧。播放结束事件

这个控件没怎么用过,你看看我的代码,参考一下:

 Option Explicit
Private Plays() As String, PlayIndex As Integer
Private Sub Command1_Click()
    If Text1.Text <> "" Then
        Dim w1 As String, w2 As String, i As Integer
        Plays = Split(Text1.Text, vbCrLf)
        ''去掉不存在的歌曲和空白的行
        For i = 0 To UBound(Plays)
            w2 = Trim(Plays(i))
            If w2 <> "" Then
                If Dir(w2) <> "" Then w1 = w1 & IIf(w1 <> "", vbCrLf, "") & w2
            End If
        Next
        Plays = Split(w1, vbCrLf) ''得到有效的地址
        PlayIndex = 0
        Wmp.URL = Plays(0) ''播放第一首
        Wmp.Controls.play
    Else
        MsgBox "请输入音乐地址!"
    End If
End Sub
Private Sub Timer1_Timer()
    If Wmp.playState <> wmppsPlaying Then
        Wmp.Controls.play
    Else
        Timer1.Interval = 0
    End If
End Sub
Private Sub Wmp_PlayStateChange(ByVal NewState As Long)
    Select Case NewState
    Case 8
        PlayIndex = PlayIndex + 1
        If PlayIndex > UBound(Plays) Then PlayIndex = 0
        Wmp.URL = Plays(PlayIndex)
        ''Wmp.Controls.play''这里不起作用,不知为啥
        Timer1.Interval = 100 ''只好用定时器来启动了
        Timer1.Enabled = True
    End Select
End Sub