public TreeNode GetNodeByPath(TreeNode rootNode, string strFullPath)
{
if(rootNode==null)
return null;
TreeNode hotNode = rootNode;
string[] nodes = strFullPath.Split('\\');
for(int i=1; i<nodes.Length; i++)
{
TreeNode node0 = null;
foreach(TreeNode node in hotNode.Nodes)
{
if(node.Text == nodes[i])
{
node0 = node;
break;
}
}
if(node0 == null)
break;
hotNode = node0;
}
return hotNode;
}
Rob R. Ainscough wrote:
Looking for an efficient way to get a TreeNode out of my rootTreeNode -- for
example I know the FullPath -- is there a quick way to locate the node
matching my FullPath?
Rob.