Forum Discussion
YMinaev
Staff
14 years agoHi,
Actually, you need to check k,your function's return value before using it. Also, you should obtain the subsequent call's result. I'd rewrite your code like this:
Actually, you need to check k,your function's return value before using it. Also, you should obtain the subsequent call's result. I'd rewrite your code like this:
function FindNode(treeObj, soughtNode)
{
for (var i = 0; i < treeObj.Nodes.Count; i++)
{
var node = treeObj.Nodes.Item(i);
if(SameText(soughtNode, node.Text.OleValue))
{
return node;
}
node = FindNode(node, soughtNode);
if(!node) break;
}
Log.Warning("Node not found");
return null;
}
...
var node = FindNode(treeObj, soughtNode);
if(node) node.set_Selected(true);
...