Go to a specified node in treeview
-
Locate the node using the control's
Nodes
property. Then set the control'sSelectedNode
property. /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Locate the node using the control's
Nodes
property. Then set the control'sSelectedNode
property. /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
No. But, I'll be more than happy to help if you have a specific question after trying to do this yourself. /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
No. But, I'll be more than happy to help if you have a specific question after trying to do this yourself. /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
No. But, I'll be more than happy to help if you have a specific question after trying to do this yourself. /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Iterate through the
Nodes
collection; check eachTreeNode
to see if it matches your criteria. If it does, set the control'sSelectedNode
property. /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
This example assumes that the node's Tag property contains the data (like a key value) that you're looking for:
public TreeNode GetTreeNode(string sNodeTag)
{
TreeNode oRetVal = null;foreach (TreeNode oNode in treeView1.Nodes) { if ((string)oNode.Tag == sNodeTag) { oRetVal = oNode; break; } } return oRetVal;
}
Everything makes sense in someone's mind
-
This example assumes that the node's Tag property contains the data (like a key value) that you're looking for:
public TreeNode GetTreeNode(string sNodeTag)
{
TreeNode oRetVal = null;foreach (TreeNode oNode in treeView1.Nodes) { if ((string)oNode.Tag == sNodeTag) { oRetVal = oNode; break; } } return oRetVal;
}
Everything makes sense in someone's mind
I don`t want to get a specified node in treeview I want to set a specified node in treeview.it means I want to go to specified node in treeview How can I do it ?
Hello Friends
-
Iterate through the
Nodes
collection; check eachTreeNode
to see if it matches your criteria. If it does, set the control'sSelectedNode
property. /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Iterate through the
Nodes
collection; check eachTreeNode
to see if it matches your criteria. If it does, set the control'sSelectedNode
property. /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
I don`t want to get a specified node in treeview I want to set a specified node in treeview.it means I want to go to specified node in treeview How can I do it ?
Hello Friends
When you say "set a specified node in treeview", I'm guess you're talking about setting the SelectedNode. Again, this code assumes that you have stored a distinct value to each node's Tag property, and are passing that value into this method.
public void SetActiveNode(string sNodeTag)
{
foreach (TreeNode oNode in treeView1.Nodes)
{
if ((string)oNode.Tag == sNodeTag)
{
SelectedNode = oNode;
break;
}
}
}Everything makes sense in someone's mind