[HLPLZ]

Posts 1–6 of 6 · Page 1 of 1
[HLPLZ]
I wonder why this aint working

Code:
Dim di As New IO.DirectoryInfo(somePATH)
Dim aryFi As IO.FileInfo() = di.GetFiles(FileIO.SearchOption.SearchAllSubDirectories, "*.mp3")
Conversion from string "*.txt" to type 'Integer' is not valid.
thanks for any help
Try this , Maybe works with ur program..

I tried this to get all mp3 files from my music folder where i got more folders on it..
Code:
      Try
            Dim di As New IO.DirectoryInfo("C:\Users\-Away\Music\")

            Dim aryFi As IO.FileInfo() = di.GetFiles("*.mp3", IO.SearchOption.AllDirectories)

            For i = 0 To aryFi.Length -1
                ListBox1.Items.Add(aryFi(i).FullName)
            Next
        Catch ex As Exception

        End Try
If you want to get only the file name without the path then change the ".FullName" to ".Name", But i dont even know if you want to get it xD
WOrked with me..

PS: I think ur problem is this: FileIO.SearchOption.SearchAllSubDirectories, "*.mp3"

Must be the "*.mp3" first and then instead of FileIO.SearchOption.SearchAllSubDirectories use IO.SearchOption.AllDirectories

Like this: di.GetFiles("*.mp3", IO.SearchOption.AllDirectories)
what do you want to do exactly..?
just get file names from directory and all subfolders
Quote Originally Posted by House View Post
just get file names from directory and all subfolders
Code:
Dim di As New IO.DirectoryInfo("PATH")

            Dim aryFi As IO.FileInfo() = di.GetFiles("*.mp3", IO.SearchOption.AllDirectories)

' To put in a listbox..
            For i = 0 To aryFi.Length -1
                ListBox1.Items.Add(aryFi(i).FullName) ' Name With the path, You can change 2 "Name"
            Next
Quote Originally Posted by -Away Alt View Post
Code:
Dim di As New IO.DirectoryInfo("PATH")

            Dim aryFi As IO.FileInfo() = di.GetFiles("*.mp3", IO.SearchOption.AllDirectories)

' To put in a listbox..
            For i = 0 To aryFi.Length -1
                ListBox1.Items.Add(aryFi(i).FullName) ' Name With the path, You can change 2 "Name"
            Next
Thanks man it worked, thanked repd
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us