|
-
May 22nd, 2002, 11:43 PM
#1
How to select a node that I just added in a TreeView?
Dear all,
I want to make the node which I just added in the treeview selected. Can anyone tell me how to do that??
Thanks in advance.
Eddie
Last edited by Eddie Lin; May 23rd, 2002 at 12:47 AM.
-
May 23rd, 2002, 12:49 AM
#2
tree.Nodes.Add("Parent");
tree.Nodes[0].Nodes.Add("Child 1");
tree.Nodes[0].Nodes.Add("Child 2");
tree.Nodes[0].Nodes[0].Nodes.Add("Grandchild 1"); // child of child 1
Then:
tree.SelectedNode = tree.Nodes[0].Nodes[1]; // select Child 2
-or-
TreeNode MyNode = tree.Nodes[0].Nodes[1];
tree.SelectedNode = MyNode;
Hope this helps,
- Nigel
-
May 23rd, 2002, 01:11 AM
#3
Dear Nigel,
I got it!! Thanks a lot!!
Regards,
Eddie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|