Jun 30, 2003 #1 seanbo Programmer Jun 6, 2003 407 GB i have a treeview with an unknown amount of treeNodes in it. i have the name of a treenode, how can i use this to get the corresponding treenode? note - if the treenode i'm looking for should always be there, and it will be a child of treeview.topnode
i have a treeview with an unknown amount of treeNodes in it. i have the name of a treenode, how can i use this to get the corresponding treenode? note - if the treenode i'm looking for should always be there, and it will be a child of treeview.topnode
Jun 30, 2003 Thread starter #2 seanbo Programmer Jun 6, 2003 407 GB try this... private TreeNode node(String nodeName, TreeView treeView1){ foreach(TreeNode tempNode in treeView1.TopNode.Nodes){ if(tempNode.Text == nodeName) return tempNode; } return null; } ...it searches every direct child of topnode. Upvote 0 Downvote
try this... private TreeNode node(String nodeName, TreeView treeView1){ foreach(TreeNode tempNode in treeView1.TopNode.Nodes){ if(tempNode.Text == nodeName) return tempNode; } return null; } ...it searches every direct child of topnode.