By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,619 Members | 1,534 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,619 IT Pros & Developers. It's quick & easy.

Selecting a Node in a TreeNode from a TreeView

P: n/a
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
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Am 14.10.2005, 14:11 Uhr, schrieb Stefan <cy************@newsgroup.nospam>:
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[i].Text == searchname) {
TreeNode selectionnode = searchnode.Nodes[i];
treeView1.SelectedNode = selectionnode;
treeView1.Select();
i = searchnode.Nodes.Count;
}
}
Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.