Show Directory in Listbox?

Mattyl110792

Daemon Poster
Messages
1,027
Hi,

I am using Visual Basic and i was wondering how i would go about displaying in a listbox, or textbox, a list of the directories inside a directory....for example...

You have a folder C:\test\.....i want to display all subdirectories like C:\test\01
C:\test\02\ etc....

So the text box in this instance would look like so...


All help is greatly appreciated...

Thanks,

Matt
 
To the best of my recollection, you'd use a DriveListBox, a DirListBox and a FileListBox linked by properties this way to select a file and path. The code that links them is :

Code:
Private Sub Dir1_Change()
    File1.Path = Dir1.Path
End Sub

Private Sub Drive1_Change()
    Dir1.Path = Drive1.Drive
End Sub

Private Sub File1_Click()
    SelectedFile = File1.Path & "\" & File1.filename
    Image1.Picture = LoadPicture(SelectedFile)
End Sub

I hope that this snippet will guide toward what you want to do.
 
Back
Top Bottom