Articles in this section
Category / Section

How to add nodes using the keyboard in WinForms TreeViewAdv?

Add nodes to TreeViewAdv

The nodes can be added to the WinForms TreeViewAdv when any key is pressed whereby the text of the node reflects the key that has been used for adding the node by using the following code in the TreeViewAdv KeyDown Event handler.

C#

private void treeViewAdv1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
    TreeNodeAdv node = new TreeNodeAdv("Node " + e.KeyData.ToString());
    this.treeViewAdv1.SelectedNode.Nodes.Add(node);
    Console.WriteLine("The " + node.Text + " is added");
}

VB

Private Sub treeViewAdv1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
    Dim node As TreeNodeAdv = New TreeNodeAdv("Node " & e.KeyData.ToString())
    Me.treeViewAdv1.SelectedNode.Nodes.Add(node)
    Console.WriteLine("The " & node.Text & " is added")
End Sub

 

Conclusion

I hope you enjoyed learning about how to add nodes to the WinForms TreeViewAdv using the Keyboard.

You can refer to our WinForms TreeViewAdv feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms TreeViewAdv example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied