Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hi,

I have a arraylist full of paths and want to show them in a treeview( like in Konqueror )
but I do not manage it.
An example:
Dir1/
Dir1/SubDir1/SubDir2/
Dir1/SubDir1/AnotherSubDir1/
Dir1/SubDir3/SubDir4/Subdir5/
Dir1/AnotherSubdir2/SubDir5/
They are no real directories
Please help!

Thanky very much!!!

modified on Wednesday, August 5, 2009 9:33 AM
Posted

1 solution

Hi,

for each entry in the list, you must locate or create the items in the listview.

Here is the logic, with an example:

adding "Dir1/SubDir3/SubDir4/Subdir5/"

is Dir1 in the top level of the listview? yes, since you already did some entries.

is SubDir3 in the Dir1 level of the listview? no, so create it

is SubDir4 in the Dir1/SubDir3 level? no, so create it

etc.


Classes you will need include the System.IO.Path class to get path parts (alternatively you could use string.Split)

:)

 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900