|
-
Dec 4th, 2013, 04:54 PM
#1
Thread Starter
PowerPoster
[RESOLVED] Loading specific files from folder into treeview
Hi there,
I have to load more then 8K images into a treeview, which won't work due to out-of-memory-exception, but that's not for now.
I have a list of all names of the files within the imagefolder. Specific files need to be within a different parent-node.
How do I accomplish this? (if within an array: how do I apply it within my code?)
My code (3rd party control):
Code:
Dim lnode As New Node("Exceptions") ' create parentnode
.Nodes.Add(lnode) ' add parentnode to treeview
For Each x In My.Computer.FileSystem.GetFiles(msopath)
Dim n As New Node(Path.GetFileNameWithoutExtension(x.ToString))
'n.Image = Image.FromFile(x) ' <-- comment out for now... out-of-memory exception
lnode.Nodes.Add(n) ' add the filnames (and the image) to the parentnode
Next
-
Dec 5th, 2013, 01:18 AM
#2
Re: Loading specific files from folder into treeview
Hi,
You need to create treenode objects to add it on the treeview control.
Say, you wanna add 10 filenames to treeview control only in parent nodes
Code:
Private Sub AddFilesTreeview()
If items.Count > 0 Then
For Each item As String In items
Dim treenode As New TreeNode()
treenode.Name = item
treenode.Text = item
TreeView1.Nodes.Add(treenode) ' add the filnames (and the image) to the parentnode
Next
End If
End Sub
Where items is a List<string> object that contains filenames.
-
Dec 5th, 2013, 06:43 AM
#3
Thread Starter
PowerPoster
Re: Loading specific files from folder into treeview
I think your suggestion gave me an idea. Thanks for your input.
-
Dec 5th, 2013, 06:51 AM
#4
Re: Loading specific files from folder into treeview
Cheers! Welcome!
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
|