System.Windows.Forms.TreeNodeCollection.Add Method

Adds a previously created tree node to the end of the tree node collection.

Syntax

public virtual int Add (TreeNode node)

Parameters

node
The System.Windows.Forms.TreeNode to add to the collection.

Returns

The zero-based index value of the System.Windows.Forms.TreeNode added to the tree node collection.

Remarks

This version of the TreeNodeCollection.Add(string) method allows you to add previously created System.Windows.Forms.TreeNode objects to the end of the tree node collection.

You can also add new System.Windows.Forms.TreeNode objects to the collection by using the TreeNodeCollection.AddRange(TreeNode[]) or TreeNodeCollection.Insert(int, 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