Selecting a TreeNode by RIGHT CLICKING on it, I m using VB.Net, VS2003

causing the AfterSelect() TreeView event by right CLICKING the TreeNode

I m using VB.Net, VS2003

The AfterSelect event [say, Private Sub TreeView_AfterSelect() ] is called when we first time LEFT CLICKS a tree node in the treeView, right clicking the node doesn't selects the desired node.

How can we cause the system to select the desired node when we RIGHT CLICK on it

Also can we create a Node_Click event for treenodes / treeview in VB.Net [like there was one in VB6]

 


Also if this post is not relevant to the thread topic, please guide me where should i ask questions about configuring various controls




Answer this question

Selecting a TreeNode by RIGHT CLICKING on it, I m using VB.Net, VS2003

  • Joel Triemstra

    guys,

    don't forget to reply me please :)



  • Dave Edelman

    ok, tks very very much for the reply

    but will the mouse down event catch the RightMouseButton mouse down too



  • Tanvir Huda

    You will have to to it yourself:

    Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown

    Dim selectedNode As TreeNode

    selectedNode = Me.TreeView1.GetNodeAt(e.X, e.Y)

    Me.TreeView1.SelectedNode = selectedNode

    End Sub


  • grolich

    Yes, it will, you can check for this:

    Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown

    If e.Button = Windows.Forms.MouseButtons.Right Then

    Dim selectedNode As TreeNode

    selectedNode = Me.TreeView1.GetNodeAt(e.X, e.Y)

    Me.TreeView1.SelectedNode = selectedNode

    End If

    End Sub


  • Selecting a TreeNode by RIGHT CLICKING on it, I m using VB.Net, VS2003