Romz
Romz

Reputation: 1457

How to insert node in TreeView as the first one?

I have tree view structure , and I need to implement function:

public void InsertNodeAtTheBeginning(TreeView tree, TreeNode node)
{
  tree.Nodes.Add_(node); // node should be added as tree.Nodes[0]
}

And every other nodes should be offset: tree.Nodes[1]...tree.Nodes[tree.Nodes.Count + 1]. All nodes in the tree have .Level property is equal to 0 ( so it's like a list)

Upvotes: 0

Views: 493

Answers (1)

user27414
user27414

Reputation:

Try TreeView.Nodes.Insert(0, ...)

Upvotes: 3

Related Questions