System.Windows.Forms.TreeNodeCollection.Add Method

Creates a tree node with the specified key, text, and image, and adds it to the collection.

Syntax

public virtual TreeNode Add (string key, string text, int imageIndex)

Parameters

key
The name of the tree node.
text
The text to display in the tree node.
imageIndex
The index of the image to display in the tree node.

Returns

The System.Windows.Forms.TreeNode that was added to the collection.

Remarks

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

The imageIndex parameter refers to an image in the TreeView.ImageList property of the parent System.Windows.Forms.TreeView.

The tree node is added to the end of the collection. You can also add new System.Windows.Forms.TreeNode objects to the collection by using the TreeNodeCollection.AddRange(TreeNode[]) or erload:System.Windows.Forms.TreeNodeCollection.Insert methods.

Requirements

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