I want to set the TreeView.selected node by itterating a int List but I can't figure out how to set the childNodes. I have the following code in my custom control:
private void SetSelectedNode()
{
if (MySelectedNodeIndexes == null) return;
for (int i = 0; i < MySelectedNodeIndexes.Count; i++)
{
this.SelectedNode = this.Nodes[MySelectedNodeIndexes[i]];
}
}
This only sets the node but on the first itteration. But the second itteration should set this.SelectedNode.Nodes[first entry in MyselctedNodesIndexes].SelectedNode. and so on.
If MySelectedNodeIndexes contains {2,4,7,1} I want the selected Nodes to be: this.Nodes[2].nodes[4].nodes[7].nodes[1];
I don't know how to do this? Thanks in advance for the help.