如何将目录列表存储到数组中?我已经尝试过这种方法,但这不起作用。
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim parentinfo As New DirectoryInfo("C:\myfiles")
counter1 = My.Computer.FileSystem.GetFiles("C:\myfiles")
dirsize = counter1.Count
ReDim directory(dirsize)
For Each dir As FileSystemInfo In parentinfo.GetFileSystemInfos()
Dim i As Integer = 0
directory(i) = dir.Name
ComboBox1.Items.Add(directory(i))
i += 1
Next dir
End Sub