Articles in this section
Category / Section

How to add nodes to the WinForms TreeViewAdv using the Keyboard?

1 min read

Add nodes to TreeViewAdv

The nodes can be added to the 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.


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


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())
   Console.WriteLine("The " & node.Text & " " & "is added")
End Sub


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment