我无法访问其他特殊文件夹,例如我的音乐,请帮助我,我需要在我的文档中包含所有子文件夹..
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each foundFile As String In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.SpecialDirectories.MyDocuments, FileIO.SearchOption.SearchAllSubDirectories, "*.txt")
ListBox1.Items.Add(foundFile)
Next
End Sub
答案 0 :(得分:0)
试试这个
Dim MyDoc As New IO.FileInfo(My.Computer.FileSystem.SpecialDirectories.MyDocuments)
For Each foundFile As String In My.Computer.FileSystem.GetFiles(MyDoc.Directory.FullName, FileIO.SearchOption.SearchAllSubDirectories, "*.txt")
ListBox1.Items.Add(foundFile)
Next