Erstellen Sie eine Dateiliste in einer ListBox.
Die Dateiliste in einer ListBox anzeigen:
z.B.: FileList(ListBox1, "C:\")
Private Function FileList(ByVal Output As ListBox, ByVal Dir As String)
For Each Directory As String In My.Computer.FileSystem.GetDirectories(Dir, FileIO.SearchOption.SearchTopLevelOnly, "*.*")
Dim Folder As String = Directory.Replace(Dir, "")
Output.Items.Add("[" & Folder & "]")
Next
For Each File As String In My.Computer.FileSystem.GetFiles(Dir, FileIO.SearchOption.SearchTopLevelOnly, "*.*")
Output.Items.Add(File)
Next
End Function
2 Kommentare zum Snippet