list1.add 添加你要弄的歌曲 在windows media play 结束 事件中 触发list1 下移list1.change事件中 播放
不行啊 这样的话 liatbox里面显示的是 form1.frm等等之类的东西
将文件列表框File1(FileBox)中选中的文件加到列表框List1(ListBox)中:dim i as Long For i=0 to File1.ListCount-1 if File1.Selected()=True then "凡是选中的就添加 List1.AddItem File1.List(File1.ListIndex) endi next
又错了:应为if InStr(List1.List(j),trim(File1.List(File1.ListIndex)))=0 then
昨天晚上回去上机试了一下,添加一首歌曲没问题,如果要选择多首歌曲,那添加的只是你选择的最后一首歌曲。 如果要添加选择的多首歌曲,程序应改为如下才行:dim i as Long,j as long For i=0 to File1.ListCount-1 if File1.Selected(i)=True then "凡是选中的就添加(不能重复) for j=0 to List1.ListCount-1 if trim(List1.List(j))<>trim(File1.List(i)) then List1.AddItem File1.List(i) List1.refresh endif next endif next 还有一个问题:添加进来的歌曲只是文件名,没有路径,要将这个路径记住,也就是来自哪个文件夹。否则是没法播放的。
在windows media play 结束 事件中 触发list1 下移list1.change事件中 播放
这样的话
liatbox里面显示的是
form1.frm等等之类的东西
For i=0 to File1.ListCount-1
if File1.Selected()=True then "凡是选中的就添加
List1.AddItem File1.List(File1.ListIndex)
endi
next
Selected() 改为:Selected(i)
List1.AddItem File1.List(i) 再试一下
是我操作的时候出现了点小错误
不过
你的endif漏写成了endi
能不能再请教一下
怎么拒绝它重复加入信息啊
如果要添加选择的多首歌曲,程序应改为如下才行:dim i as Long,j as long
For i=0 to File1.ListCount-1
if File1.Selected(i)=True then "凡是选中的就添加(不能重复)
for j=0 to List1.ListCount-1
if trim(List1.List(j))<>trim(File1.List(i)) then
List1.AddItem File1.List(i)
List1.refresh
endif
next
endif
next 还有一个问题:添加进来的歌曲只是文件名,没有路径,要将这个路径记住,也就是来自哪个文件夹。否则是没法播放的。