vb MediaPlayer的URL选择MP3添加进去

来源:百度知道 编辑:UC知道 时间:2024/05/09 11:06:41
我的代码如下:Option Explicit
Private Sub Command1_Click()
Dim dbpath As String
MediaPlayer1.URL = (dbpath)
MediaPlayer1.Controls.play
End Sub

Private Sub Command2_Click()
MediaPlayer1.Close
End Sub

Private Sub Dir1_Change()
Form1.File1.Path = Form1.Dir1.Path
End Sub
Private Sub Drive1_Change()
Form1.Dir1.Path = Form1.Drive1.Drive
End Sub

Private Sub File1_Click()
dbpath = Form1.File1.Path
End Sub
但是他老提示dbpath没有定义?我用的是VB6.0精简版的。用的播放器是windows自带的版本10.00 系统是XPSP2的有没有高手帮我看看代码到底哪里出错了?如果固定URL的话可以播放。

前三句更改一下顺序。
Option Explicit
Dim dbpath As String
Private Sub Command1_Click()

你的dbpath值等于file1.path,是个文件夹,怎么播放呢?
你要做的肯定是点哪个文件,就播放哪个,对不对?
把最后一部分file1_click里面的那句赋值改成我这个,
保证可以.

Private Sub File1_Click()
dbpath = Form1.File1.Path & "\" & File1.FileName
End Sub

Vb都告诉你了嘛: dbpath没有定义