Click to See Complete Forum and Search --> : Adding files to a treeview in a hierarchal format
bobbasic2002
Sep 3rd, 2002, 10:10 AM
Hi,
Does anyone know how can I add files like “C:\temp\help.txt” in the format of
temp
help.txt
in a treeview. It should be dynamic, that is, I can also add “C:\temp\now\read.txt” and it should add it to
temp
now
read.txt
help.txt
anyone knows how to do this?
Thank you,
Bob
Edneeis
Sep 3rd, 2002, 11:35 AM
http://www.vbcity.com/forums/topic.asp?tid=9861
bobbasic2002
Sep 3rd, 2002, 02:49 PM
Can this code be refined so that all the folders are listed first in the treeview and then the files? Because if I insert "C:\temp\fun.txt" this is listed before "C:\temp\zee\name.txt".
Thank you,
Bob
Edneeis
Sep 3rd, 2002, 03:19 PM
I'm not sure I follow you. The files and folders are listed in a hierarchy so if a file and folder share the same parent then they are both equally listed below that parent.
Edneeis
Sep 3rd, 2002, 03:58 PM
Here is what it looks like for me:
http://www.vbforums.com/attachment.php?s=&postid=1156422
You can sort it using the sort property of the treeview. Or maybe you mean you want all the folders to be on top of any files when they are on the same level. If so then you'd have to use Insert instead of add and work out some way of knowing where to put it.
bobbasic2002
Sep 3rd, 2002, 04:54 PM
Hi,
Yes, I wanted the folders first and then the files. Like in your example you have the file 040D.CS_ before the “lang” folder. I wanted the folders first. But, it is okay I figured it out. Thank you so much for your help.
Now, I need to know to go back again. That is, if the user selects a node in the treeview and clicks the remove button all the nodes and child nodes are deleted from the treeview and their full names are inserted in a list box.
For example, if someone selects the “lang” node and clicks remove, all the nodes and child nodes are deleted from the treeview and,
“C:\I386\lang\HEB\MRIAMTR.TT_”
“C:\I386\lang\UNIPROC\MP2UP.INF”
Should be added to a list box.
Thank you,
Bob
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.