471,350 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Treeview Search

Hi
I'm trying to do a text search on a TreeView control. So far I've been able
to find the matching items and add them to another treeView but I want to be
able to add its whole path to the other treeView and not just the matching
node.
Any ideas on how to do this?
Jan 16 '06 #1
1 3493
You will need to implement a simple recursive routine:

TreeViewWalk(treeView.Nodes);


private void TreeViewWalk(TreeNodeCollection nodes)
{
foreach (TreeNode node in nodes)
{
// do what you want to do with 'node' here.

if (node.ChildNodes.Count > 0)
{
TreeViewWalk(node.ChildNodes, list);
}
}
}

--

Andrew Robinson
blog.binaryocean.com
www.binaryocean.com
"AlexDP" <Al****@discussions.microsoft.com> wrote in message
news:84**********************************@microsof t.com...
Hi
I'm trying to do a text search on a TreeView control. So far I've been
able
to find the matching items and add them to another treeView but I want to
be
able to add its whole path to the other treeView and not just the matching
node.
Any ideas on how to do this?

Jan 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Ben Coats | last post: by
1 post views Thread by Mark | last post: by
reply views Thread by Dianna | last post: by
3 posts views Thread by Jeff | last post: by
2 posts views Thread by =?Utf-8?B?anAybXNmdA==?= | last post: by
5 posts views Thread by Max2006 | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.