System.Windows.Forms.TreeNodeCollection.Insert Method

Creates a tree node with the specified text and key, and inserts it into the collection.

Syntax

public virtual TreeNode Insert (int index, string key, string text)

Parameters

index
The location within the collection to insert the node.
key
The name of the tree node.
text
The text to display in the tree node.

Returns

The System.Windows.Forms.TreeNode that was inserted in 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 is sorted again.

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

The TreeNode.Name property corresponds to the key for a System.Windows.Forms.TreeNode in the System.Windows.Forms.TreeNodeCollection.

Requirements

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