the TreeNode FindNodeByValue public (TreeNodeCollection trCollection, String szTxtName)
{
the TreeNode trNode = null;
// Tree root node through all of
the foreach (TN in the TreeNode trCollection)
{
// each method to find the root substituting
trNode = FindNode (tn, szTxtName);
// find the output
IF (trNode = null)!
{
return trNode;
}
}
return trNode;
}
// recursive queries to find the node returns
Private TreeNode FindNode (TreeNode the Node, String name)
{
// accept the return of node
TreeNode RET = null;
// loop Find
foreach (TreeNode in the TEMP node.Nodes)
{
// has children node
IF (temp.Nodes.Count = 0!)
{
// If found
IF ((RET = FindNode (TEMP, name)) = null!)
{
return RET;
}
}
// if found
if (string.Equals(temp.Text, name))
{
return temp;
}
}
return ret;
}