How to: Add and Remove Nodes with the Windows Forms TreeView Control Using the Designer
Because the Windows Forms TreeView control displays nodes in a hierarchical manner, when adding a node you must pay attention to what its parent node is.
The following procedure requires a Windows Application project with a form containing a TreeView control. For information about setting up such a project, see How to: Create a New Windows Forms Application Project and How to: Add Controls to Windows Forms.
Note
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Working with Settings.
To add or remove nodes in the designer
Select the TreeView control.
In the Properties window, click the Ellipsis () button next to the Nodes property.
The TreeNode Editor appears.
To add nodes, a root node must exist; if one does not exist, you must first add a root by clicking the Add Root button. You can then add child nodes by selecting the root or any other node and clicking the Add Child button.
To delete nodes, select the node to delete and then click the Delete button.
See Also
Tasks
How to: Set Icons for the Windows Forms TreeView Control
How to: Iterate Through All Nodes of a Windows Forms TreeView Control
How to: Determine Which TreeView Node Was Clicked (Windows Forms)
How to: Add Custom Information to a TreeView or ListView Control (Windows Forms)
Reference
TreeView Control Overview (Windows Forms)