System.Windows.Forms.TreeNodeCollection.Insert Method

Inserts an existing tree node into the tree node collection at the specified location.

Syntax

public virtual void Insert (int index, TreeNode node)

Parameters

index
The indexed location within the collection to insert the tree node.
node
The System.Windows.Forms.TreeNode to insert into the collection.

Remarks

If the TreeView.Sorted property is set to true, the index parameter value is ignored. The System.Windows.Forms.TreeNode is inserted into the tree view, and the System.Windows.Forms.TreeView resorted.

You can also add new System.Windows.Forms.TreeNode objects to the collection by using the TreeNodeCollection.Add(string) or TreeNodeCollection.AddRange(TreeNode[]) methods.

To remove a System.Windows.Forms.TreeNode that you previously added, use the TreeNodeCollection.Remove(TreeNode), TreeNodeCollection.RemoveAt(int), or TreeNodeCollection.Clear methods.

Note:

A System.Windows.Forms.TreeNode can be assigned to only one System.Windows.Forms.TreeView control at a time. To add the tree node to a new tree view control, you must remove it from the other tree view first or clone it.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0