S
Steve
I'm surprised that I'm having trouble with this, I have done this before...
anyway, I'm trying to locate a TreeNode in a TreeView wqith a recursive
function, here is the code
<code>
private TreeNode RecursivelyFindNodeByTag(TreeNode node, Object data)
{
if(node.Tag == data)
{
return node;
}
foreach(TreeNode n in node.Nodes)
{
if(n.Tag == data)
{
return n;
}
RecursivelyFindNodeByTag(n, data);
}
return null;
}
</code>
I pass the TopNode to the initial call to RecursivelyFindNodeByTag
It find the node, but the stack still needs to unwind it's calls, as is it
does, it returns null. I'm after a total block on this, what am I doing
wrong?
Thanks for taking a look,
Steve
anyway, I'm trying to locate a TreeNode in a TreeView wqith a recursive
function, here is the code
<code>
private TreeNode RecursivelyFindNodeByTag(TreeNode node, Object data)
{
if(node.Tag == data)
{
return node;
}
foreach(TreeNode n in node.Nodes)
{
if(n.Tag == data)
{
return n;
}
RecursivelyFindNodeByTag(n, data);
}
return null;
}
</code>
I pass the TopNode to the initial call to RecursivelyFindNodeByTag
It find the node, but the stack still needs to unwind it's calls, as is it
does, it returns null. I'm after a total block on this, what am I doing
wrong?
Thanks for taking a look,
Steve