Hello there,
How can i add a node in a certian place in a treeView control?

Thanks ahead

first thanks,
but it dosent help me since i need to add a node i a certian place

but it dosent help me since i need to add a node i a certian place

Why doesn't it help? It shows you that you can add and remove from the collection. That means you can copy the collection to a list that you can edit using indexes, clear the collection, and then add the range of the edited list back to the empty collection.

maybe he/she doesn't know how to find that certain place to begin, i.e they don't know how to traverse the tree (so-to-speak)?

I guess that I understand your question u can use the code
treeView1.Nodes.Insert(2, new TreeNode("Forth tree node"));

if I needs to get the index of the last node in the tree, how can I do that.
In the Add() method, it normally add the new node to the end of the tree, so how the add method find the last position...?

TreeView treeView1 = new TreeView();
treeView1.Location = new System.Drawing.Point(1, 0);
treeView1.Name = "treeView1";
treeView1.Size = new System.Drawing.Size(153, 204);
this.Controls.Add(treeView1);
treeView1.Nodes.Add("Sample_Node");
treeView1.Nodes[0].Nodes.Add("sample1");

This article has been dead for over six months. Start a new discussion instead.