Treeview Howto

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have user selecting a branch on a treeview. Is it possible to gather the
values of all child nodes of the selected node, and put the values into an
arraylist? If you have any examples I would appreciate it.
 
I have user selecting a branch on a treeview. Is it possible to gather the
values of all child nodes of the selected node, and put the values into an
arraylist? If you have any examples I would appreciate it.

Something like this will pick up the first level nodes, if you want their
children it would need to be recursive.

ArrayList al = new ArrayList();
TreeNode tnSelected = tv.SelectedNode;

foreach(TreeNode tNode in tnSelected.Nodes)
al.Add(tNode);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top