473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Detecting items in the nodes of a Treeview Control

I have a Treeview Control on my Windows Form with a directory structure, ie a list of nodes. This is actually a directory listing from my c drive (similiar to Windows Exlorer).

I can iterate through all the foldernames as in the code below, but how can I detect filenames that are held within the folders?

Private Sub PrintRecursive(ByVal n As TreeNode)
System.Diagnostics.Debug.WriteLine(n.Text)
MessageBox.Show(n.Text)
Dim aNode As TreeNode
For Each aNode In n.Nodes
PrintRecursive(aNode)
Next
End Sub

' Call the procedure using the top nodes of the treeview.
Private Sub CallRecursive(ByVal aTreeView As TreeView)
Dim n As TreeNode
For Each n In aTreeView.Nodes
PrintRecursive(n)
Next
End Sub
Mar 23 '07 #1
2 1277
kenobewan
4,871 Expert 4TB
Here is an article that may help:
ASP.NET 2.0 Site Navigation Features
Mar 26 '07 #2
I have a TreeView control on my Windows form. It is populated by a user selecting a folder. This folder may have several subfolders (it is unknown at runtime)

I want to iterate though every folder, subfolder and items within those folders. I am using the following bit of code as supplied in the help files, but it only runs through the parent folder and child. I want to be able to run through the child's folders as well.

Private Sub ChildNodes(ByVal n As TreeNode)
System.Diagnostics.Debug.WriteLine(n.Text)
MessageBox.Show(n.Text)
Dim aNode As TreeNode
For Each aNode In n.Nodes
ChildNodes(aNode)
Next
End Sub

' Call the procedure using the top nodes of the treeview.
Private Sub ParentNodes(ByVal aTreeView As TreeView)
Dim n As TreeNode
For Each n In aTreeView.Nodes
ChildNodes(n)
Next
End Sub
Mar 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Hrvoje Voda | last post by:
I made my own user treeview control. Now, I can't access the method treeview.Nodes ! Why? Hrcko
0
by: stardust | last post by:
Hi everyone, Within a Winform application, a treeview is contained in a User Control and the User Control is then located within a splitview. When the UserControl added some nodes into the...
1
by: EOS | last post by:
Hi, I am new to PDA development and my background is purely C/C++. Now I can get the rought ideas on Compact C# .net for PDA development. But I am having troubles on adding TreeView with nodes...
1
by: christoffer.lantz | last post by:
Howdy folks. Would anyone care to suggest a way to have sibling nodes (at the same level) collapse when a node is expanded in an asp.net 2.0 treeview control? What I mean is that I want only one...
1
by: garyusenet | last post by:
Hi All, I'm eagerly anticipating what you have to say on something that's stumped me over the weekend. I'm writing a small application which utilises a treeview control. I've figured out how to...
3
by: Ray Booysen | last post by:
Hi all I have a treeview bound to a sitemap. Once the user is logged in, I'm wanting the menu to expand to include additional items from a database while retaining the items in the sitemap. Is...
2
by: Kristopher Wragg | last post by:
I'm having some serious problems with the TreeView control. I've got a control that inherits TreeView and has some methods that firstly create a TreeNode then does some recursive procedure to add...
0
debasisdas
by: debasisdas | last post by:
Select Microsoft windows common controls 6.0 (SP6) from components Add a TreeView control to the form. Add a ImageList control to the form. Add some bitmaps to the imagelist. Set the name of...
0
debasisdas
by: debasisdas | last post by:
This sample code displays employee name in the treeview control from the emp table of Scott schema in oracle database. To start with Select Microsoft windows common controls 6.0 (SP6) from...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.