TreeView double click event

  • Thread starter Thread starter HS1
  • Start date Start date
H

HS1

Hellow all
Could you please tell me how to do if I want to print (using console) any
node in a TreeView when I "double" click a node (in a Windows application).
I tried to use TreeViewAfterSelect event, However, it is not good as it is
single click.
Thanks
SH1
 
try this:

Private m_x As Integer
Private m_y As Integer

Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) _
Handles TreeView1.MouseDown
m_x = e.X
m_y = e.Y
End Sub

Private Sub TreeView1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TreeView1.DoubleClick
Dim objTreeNode As TreeNode

objTreeNode = TreeView1.GetNodeAt(m_x, m_y)
If Not (objTreeNode Is Nothing) Then
Debug.WriteLine("You double clicked " & objTreeNode.Text)
End If

End Sub

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top