display music file

meodihia

New member
Joined
Jan 11, 2009
Messages
1
Programming Experience
Beginner
I want to display music file (extension .wma ,.mp3 , .avi, etc..)
But I dont know how to display with a lot of extension
This is my code:
VB.NET:
Private Sub TreeView1_NodeMouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseDoubleClick
        Dim catchNode As String
        catchNode = TreeView1.GetNodeAt(e.X, e.Y).FullPath
        Dim di As New IO.DirectoryInfo("E:\Music\" & catchNode)
        ListBox1.DataSource = di.GetFiles("*.mp3", IO.SearchOption.AllDirectories)
    End Sub
It's only display file extension .mp3 in ListBox1, but I want display more file extension
Can you help me?
Thanks for advanced!
 
If you want to get multiple extensions then you have to call GetFiles multiple times. Just create a List(Of FileInfo) and call AddRange each time to add the files with each extension. Once you've added all the files you can bind the List to your ListBox.
 
Back
Top