Hi all,
I am new to C#. I am currently implementing a treeview.But I am not sure how to search for treenodes. If I have a parent 'John' with child nodes 'B' and 'C', is there any way to find out the path that I select for 'B' is A-B.
Can any one provide an example of searching treenodes
Thanks

How to search treenode?
Loren Bain
Hi all,
My problem is if I have 2 nodes 'A' and 'B' and under node 'A' and 'B' , I have node 'C' for both which are the same text.How can I differentiate between the two nodes 'C'
I can only differentiate by the path which is 'A-C' and 'B-C'. Am I right In that case, how can I get the path name
Thanks
sbr7770
Each node has a parent property, and a collection of child nodes. You can use a recursive function to walk this tree if you need to.
arrayhunter
hi,
yes thats true when you creat a node you have to give it unique name, if you can't do that then you can use the tag property and give it unique id , number, or name and etirate through your node.tag it will be better
Hope that helps
offwhite
First of all when you set the tree up I would set unique names for your nodes like this.
A Name = A
C Name = AC
B Name = B
C Name = BC
Second you can get the path of the node by doing this
node.FullPath
You can differentiate by Name or FullPath, I think thats it. or maybe imageindex if your using that and its different for the two C nodes.
seva04121973
hi,
yes as what cgraus told you, something like this
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e){
if (e.Node.Text == "first customer"){
MessageBox.Show("Parent node is : " + e.Node.Parent.Text);}
}
hope that helps