treeview urgent!!!!

  • Thread starter Thread starter '[] WiRaN
  • Start date Start date
W

'[] WiRaN

Mine treeview contains some levels, necessary to look a NODE, and it it can
be in such a way in the first level how much in the four level, somebody can
help me to make a function?
 
Are you looking for a way to count all the nodes in the four levels or are
you looking for a way to find a specific node no matter which level it is
at? (Though the solutions would both involve a recursive search.)

Dale
 
I'd like to help you, but I don't understand your English. Are you
asking how to have the treeview open to a particular node in the
tree?
 
necessary to find a knot I specify, and it can be in any level!!!
Bruno

DalePres said:
Are you looking for a way to count all the nodes in the four levels or are
you looking for a way to find a specific node no matter which level it is
at? (Though the solutions would both involve a recursive search.)

Dale

'[] WiRaN said:
Mine treeview contains some levels, necessary to look a NODE, and it it can
be in such a way in the first level how much in the four level, somebody can
help me to make a function?
 
I want to look one node specific in any place of treeview
Bruno..

NoLongerMicah said:
I'd like to help you, but I don't understand your English. Are you
asking how to have the treeview open to a particular node in the
tree?
 
necessary to find a knot I specify, and it can be in any level!!!
Bruno

DalePres said:
Are you looking for a way to count all the nodes in the four levels or are
you looking for a way to find a specific node no matter which level it is
at? (Though the solutions would both involve a recursive search.)

Dale

'[] WiRaN said:
Mine treeview contains some levels, necessary to look a NODE, and it it can
be in such a way in the first level how much in the four level,
somebody
can
help me to make a function?

Hi,

So, as I understand, you want to find a specific node in the tree. The
easiest way to implement that is by using recursion.
The following code searches for the first node having the specified text.
(If you need to find all the nodes which satisfy a specific condition, you
could save them in an array). If no such node has been found, it returns
null.


...
public TreeNode Find(string searchText)
{
return this.FindTreeNodeRecursive(this.myTreeView.Nodes,
searchText);
}

public TreeNode FindTreeNodeRecursive(TreeNodeCollection nodeCollection,
string searchText)
{
foreach (TreeNode currentNode in nodeCollection)
{
if (currentNode.Text == searchText)
{
return currentNode;
}

object searchResult =
this.FindTreeNodeRecursive(currentNode.Nodes, searchText);
if (searchResult != null)
{
return searchResult;
}
}

return null;
}

Regards,
Adrian Vinca [MSFT], Developer Division
--------------------------------------------------------------------
This reply is provided "AS IS", without warranty (express or implied).

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
 
Back
Top