|
-
Aug 6th, 2006, 05:58 PM
#1
Thread Starter
Lively Member
How Can You Change The Selected Index Of A Treeview Control
How do I change the selected index/item of a treeview control?
I tried tv.selectedindex = 5 but it says its read only.
I also tried tv.Nodes[5].IsSelected = true; but that does not work either
thanks in advance
-
Aug 6th, 2006, 06:51 PM
#2
Re: How Can You Change The Selected Index Of A Treeview Control
You go to the help documentation for the TreeView class, go to the member listing topic, look down the list of properties until you come to "SelectedNode" and read the following description:
Gets or sets the tree node that is currently selected in the tree view control.
-
Jan 11th, 2007, 02:35 AM
#3
Frenzied Member
Re: How Can You Change The Selected Index Of A Treeview Control
that does not work form me:
this code:
Code:
TreeNode tmpNode=GetProvinceNode(iProv);
if (iCit!=0)
tmpNode=GetCityNode(tmpNode,iCit);
tmpNode.EnsureVisible();
tvwHierarchy.SelectedNode=tmpNode;
do ensure the node is visible, but does not select it.
I also wrote some code to figure out the index of the node (yes, got the right index), but still no luck. The node are visible, but selected? huh uh!
any ideas?
-
Jan 11th, 2007, 02:41 AM
#4
Frenzied Member
Re: How Can You Change The Selected Index Of A Treeview Control
ooops...did not see "ShowSelection" property
-
Jan 11th, 2007, 03:12 AM
#5
Re: How Can You Change The Selected Index Of A Treeview Control
 Originally Posted by StrangerInBeijing
ooops...did not see "ShowSelection" property 
Is that anything like the HideSelection property?
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
|