這裏是我的代碼:Visual Basic中2010 - 無法列出目錄,而不顯示路徑
Sub DataLoad()
Dim DirList As New ArrayList
GetDirectories("C:\Surf\Oversigt\", DirList)
For Each item In DirList
ListBox4.Items.Add(item)
Next
End Sub
Sub GetDirectories(ByVal StartPath As String, ByRef DirectoryList As ArrayList)
Dim Dirs() As String = Directory.GetDirectories(StartPath)
DirectoryList.AddRange(Dirs)
For Each Dir As String In Dirs
GetDirectories(Dir, DirectoryList)
Next
End Sub
我只想顯示listbox4的目錄,而不是目錄的完整路徑名。現在,它會顯示這樣的事情:
C:\衝浪\ Oversigt \文件夾等
請幫