John Q

John Q

  • NA
  • 12
  • 44.2k

Adding node to treeview control using for loop

Jan 13 2014 10:20 AM
I've a treeview1 below that I want to shorten it by using the for loop. I tried the following code but it doesn't seem to work. Am I using the treeview control correctly?  Would someone please post some tips.

treeView1.Nodes[0].Nodes[nodeCtr[0]].Nodes[nodeCtr[1]].Nodes[nodeCtr[2]].Nodes[nodeCtr[3]].Nodes[nodeCtr[4]].Nodes[nodeCtr[5]].Nodes[nodeCtr[6]].Nodes[nodeCtr[7]].Nodes[nodeCtr[8]].Nodes.Add(sfix);

for (int ii = 1; ii < 8; ii++)

{ treeView1.Nodes[0] + ".Nodes[Nodes[nodeCtr[" + ii + "]"; }


Answers (2)