Tall Dude
NogChoco,
I liked your code, so hacked on it a little to see if I
could add 'wav' files at the same time.
(My changes probably can be simplified.)
Private Sub Update_The_Playlist()
' Load all the mp3 files that are in the selected folder (stored as full filepaths, example: "c:\myFolder\myFile.mp3")
zMP3Files = New List(Of String)(My.Computer.FileSystem.GetFiles(zMP3Folder, FileIO.SearchOption.SearchTopLevelOnly, "*.mp3"))
zMP3Files.AddRange(My.Computer.FileSystem.GetFiles(zMP3Folder, FileIO.SearchOption.SearchTopLevelOnly, "*.wav"))
' create a new empty playlist for the mediaplayer
zPlaylist = AxWindowsMediaPlayer1.playlistCollection.newPlaylist("thePlaylist")
' go through the list of mp3files and add them to the new playlist
For Each zFilePath As String In zMP3Files
If (System.IO.Path.GetExtension(zFilePath)).ToUpper = ".MP3" Then
Dim zMP3File As WMPLib.IWMPMedia3 = CType(AxWindowsMediaPlayer1.newMedia(zFilePath), WMPLib.IWMPMedia3)
zPlaylist.appendItem(zMP3File)
Else
Dim zMP3File As WMPLib.IWMPMedia = CType(AxWindowsMediaPlayer1.newMedia(zFilePath), WMPLib.IWMPMedia)
zPlaylist.appendItem(zMP3File)
End If
'Dim zMP3File As WMPLib.IWMPMedia3 = CType(AxWindowsMediaPlayer1.newMedia(zFilePath), WMPLib.IWMPMedia3)
'zPlaylist.appendItem(zMP3File)
Next