Adding paths to TreeView

sentinal

New member
Joined
May 12, 2006
Messages
2
Programming Experience
Beginner
hi,

I am having trouble with adding paths to a treeview. Its driving me nuts. I just cannot get my head around it.

for example say i have the following

E:\Audio\CD1
E:\Audio\CD2
E:\Downloads\
E:\Downloads\Game1
E:\Downloads\Game2

I then use the split function to split each path using the "\" as the delimiter

My issue is that i cannot work out how i can add each folder to the tree view while maintaining the folder structure. So the result is that the folder view will look like windows explore.

Hope someone knows or has some tips.

Cheers
 
You just have to work it. Each path, each part, one by one. First path: Take first part in first path "Audio" and add it to root if it doesn't already exist. Take next part "CD1" and add it to the previous node if it doesn't already exist. Second path same, third etc.

Hint: You can make yourself a function method that returns a specific treenode from a nodes collection (including creating and adding to that collection if not exist) ;)
 
ok...i am getting a clearer pic in my head how to do this now, now thinking about it i was thinking about the path as a hole even when i used the split function.

Cheers for the tip, a different view of the problem helped.

i am away now to redo my functions...

:)
 
Back
Top