Selecting a Node in a TreeNode from a TreeView

S

Stefan

Hey guys !


Can someone pls help me and tell me how it is possible to Select a Node in
2nd row?

I got a treeview which is build like follows:

node2.Nodes.Add("blah", "blubb");
node1.Nodes.Add(node2);
treeview.Nodes.Add(node1);

now I want "blubb"-node to be selected. How can I do this?


Steve
 
S

Stefan

Hey guys !


Can someone pls help me and tell me how it is possible to Select a Node
in 2nd row?

I got a treeview which is build like follows:

node2.Nodes.Add("blah", "blubb");
node1.Nodes.Add(node2);
treeview.Nodes.Add(node1);

now I want "blubb"-node to be selected. How can I do this?


Steve



I already found what I was searchin for, but thx anyway ;o)



TreeNode searchnode = treeView1.Nodes[0];
for(int i = 0; i < searchnode.Nodes.Count; i++) {
if(searchnode.Nodes.Text == searchname) {
TreeNode selectionnode = searchnode.Nodes;
treeView1.SelectedNode = selectionnode;
treeView1.Select();
i = searchnode.Nodes.Count;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top