// Get the selected node. TreeNode selectedNode = treeView1.SelectedNode; // Add a child node to the selected node. selectedNode.Nodes.Add("Child Node");
// Get the parent node. TreeNode parentNode = treeView1.Nodes[0]; // Add multiple child nodes to the parent node. parentNode.Nodes.Add("Child Node 1"); parentNode.Nodes.Add("Child Node 2"); parentNode.Nodes.Add("Child Node 3");In these examples, the AddChildNode method is used to add child nodes to the parent node. The TreeNode class represents a node in the TreeView control. The Windows Forms library provides the TreeView control.