|
-
Jan 14th, 2004, 02:47 PM
#1
Thread Starter
Fanatic Member
populating treeview with dir and files..
any method to do this in an extrememly fast way ?
with no impact on a user waiting for it to fill?
-
Jan 14th, 2004, 10:42 PM
#2
Sleep mode
You might need to do that on different thread than the UI Thread .
-
Jan 14th, 2004, 10:52 PM
#3
Sleep mode
A quick demo . If you have any questions , post here .
VB Code:
Public Sub FILLTreeV(ByVal path As String)
Dim FitN As TreeNode
Dim DitN As TreeNode
For Each file As String In IO.Directory.GetFiles(path)
FitN = New TreeNode(file)
Me.TreeView1.Nodes.Add(FitN)
Next
For Each dir As String In IO.Directory.GetDirectories(path)
DitN = New TreeNode(dir)
Me.TreeView1.Nodes.Add(DitN)
FILLTreeV(dir)
Next
End Sub
'Use
FILLTreeV("c:\data")
-
Jan 15th, 2004, 10:13 AM
#4
Thread Starter
Fanatic Member
thanks pirate, for the sample... helped...
and also had a thought - what if i just populated all the directories -
i reworked your code to populate the tree with the directories only and that is fast ! and looks like the whole file structure is there - just what i want - but
then if a user clicks on the node to see the insides of the directory then i would populate that on the fly -
how would i do that? is there an event so i can fill in the files or (subdirectories) under the correct node of the tree?
-
Jan 15th, 2004, 11:50 AM
#5
Sleep mode
That's easy I think . I'll give you the idea , if you still can't get it to work then let me know (I'm just little busy now) . Ok , use a counter that increments folders found then use this counter as index in the treenode index value . I remember I did it this way and worked well . Sorry as I said I can't give you the full code right now but if you're stuck , then I'll help you .
-
Apr 1st, 2004, 09:19 AM
#6
Fanatic Member
Just what I was looking for.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|