locked
Treeview NodeSelect RRS feed

  • Question

  • I am trying to use the NodeMouseClick event to execute code.

    Currently I have the below code for testing that, even though it is in the NodeMouseClick it does not execute until I doubleclick

    Textbox1.Text = TreeView1.SelectedNode.Tag + "\" + Treeview1.SelectedNode.Name

    The Tag stored a path like C:\folder1\folder2 and the Name holds the current folder, so Textbox1.text would equal C:\Folder1\Folder2\currentfolder

    I have tried using a TreeView1.Refresh() but still requires a doubleclick before the date changes from the previous value, even though it is highlighted and selected.

    Thanks Gang

    Tuesday, July 28, 2020 2:58 PM

Answers

  • Please post a concise and complete example. Cause this works:

    Private Sub TreeView1_NodeMouseClick(sender As Object, e As TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseClick
        Me.Text = e.Node.Text + " !"
    End Sub
    
    Private Sub TreeView1_NodeMouseDoubleClick(sender As Object, e As TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseDoubleClick
        Me.Text = e.Node.Text + " !!"
    End Sub

    • Marked as answer by Ryan Lashway Tuesday, July 28, 2020 4:11 PM
    Tuesday, July 28, 2020 3:16 PM

All replies

  • Please post a concise and complete example. Cause this works:

    Private Sub TreeView1_NodeMouseClick(sender As Object, e As TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseClick
        Me.Text = e.Node.Text + " !"
    End Sub
    
    Private Sub TreeView1_NodeMouseDoubleClick(sender As Object, e As TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseDoubleClick
        Me.Text = e.Node.Text + " !!"
    End Sub

    • Marked as answer by Ryan Lashway Tuesday, July 28, 2020 4:11 PM
    Tuesday, July 28, 2020 3:16 PM
  • that works, question though, why didnt mine?
    Tuesday, July 28, 2020 3:54 PM
  • Try another event too: AfterSelect



    • Edited by Viorel_MVP Tuesday, July 28, 2020 4:07 PM
    Tuesday, July 28, 2020 4:04 PM
  • Craft a concise and complete example not working and we can discuss it. Just a fragment is not suitable for this.

    p.s. maybe crafting such a sample will show you the difference which may lead to your observations.

    Tuesday, July 28, 2020 4:17 PM