Может кто-нибудь сказать мне, как перечислить все подпапки в vb.net.
я хочу поместить его в список, я создал код, но он выполняет поиск только в текущем местоположении и не включает в себя подпапку. вот мой код ,,
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dnum, fnum As Integer
For Each drive As String In Directory.GetLogicalDrives()
ListBox1.Items.Add(drive)
Next drive
Do While dnum < ListBox1.Items.Count - 3
Dim di As New DirectoryInfo(ListBox1.Items(dnum))
'for every subdirectory in the folder, add its name to the listbox
For Each subdi As DirectoryInfo In di.GetDirectories
ListBox2.Items.Add(subdi.Name)
Next
dnum = dnum + 1
Loop
dnum = 0
Do While dnum < ListBox1.Items.Count - 2
fnum = 0
Do While fnum < ListBox2.Items.Count
Dim loc As String
loc = (ListBox1.Items(dnum) + ListBox2.Items(fnum))
Try
Dim di As New DirectoryInfo(loc)
'for every subdirectory in the folder, add its name to the listbox
For Each subdi As DirectoryInfo In di.GetDirectories
ListBox3.Items.Add(subdi.Name)
Next
Catch ex As Exception
End Try
fnum = fnum + 1
Loop
dnum = dnum + 1
Loop
End Sub
End Class