Avatar of NevSoFly
NevSoFly

asked on 

How to display in a treeview Folders, Subfolder and Files from a List(of String) collection.

I have a collection (List(of String)) that contains file paths.  Some of these files are in the root folder and others are in subfolders.  I want to display the paths in a treeview while keeping the hierarchy of the file structure.  For example:

c:\testfile1
c:\Folder1\testfile2
c:\Folder1\subfolder1\testfile3
c:\Folder2\testfile4
c:\Folder3\subfolder1\testfile5

Should be displayed in the treeview as:

testFile1
Folder1
     |_______testfile2
     |_______subfolder1
                           |________testfile3
Folder2
     |_______testfile4
Folder3
     |_______subfolder1
                           |________testfile5

I hope this makes sense.  Thank you for any and all help.
Visual Basic.NET

Avatar of undefined
Last Comment
NevSoFly

8/22/2022 - Mon