|
-
Apr 5th, 2007, 02:31 PM
#1
Thread Starter
Member
[RESOLVED] VS2005: How to determine which node was double-clicked
Can anyone help to determine which node was double-clicked when the doubleclick event fires for the treeview?
I am currently using an imagelist with the treeview nodes. To avoid having the selectedimage display when a node is clicked, I am cancelling the event when the BeforeSelect event fires. Therefore, the node that was just clicked is not the selected node. So I can't use the selectednode property to determine the node that was double-clicked. Any other ideas?
-
Apr 5th, 2007, 02:35 PM
#2
Re: VS2005: How to determine which node was double-clicked
The treeview control has a NodeMouseDoubleClick property that will fire when a node is double clicked
You can then determine the node by e.Node
-
Apr 5th, 2007, 02:35 PM
#3
Fanatic Member
Re: VS2005: How to determine which node was double-clicked
Here is a quick and dirty to get you started
Code:
Private Sub tvwMenu_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvwMenu.AfterSelect
Select Case e.Node.Name
Case "node1"
Case "node2"
Case Else
End Select
End Sub
D
Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP
Please Rate If I helped you. 
Please remember to mark threads as closed if your issue has been resolved.
Reserved Words in Access | Connection Strings
-
Apr 5th, 2007, 02:38 PM
#4
Thread Starter
Member
Re: VS2005: How to determine which node was double-clicked
I suppose I should have looked a bit closer. So many events compared to VB6. Thanks for the help.
Is there a better way to avoid having the image of a node change when it is selected? Seems odd that feature can't be disabled.
-
Apr 5th, 2007, 02:40 PM
#5
Re: VS2005: How to determine which node was double-clicked
Do you have a selected image? if not, then just make the selected image the same as the other image and therefore it will look the same. I haven't really played with images in treeviews so not really sure, but seems like a viable solution.
-
Apr 5th, 2007, 02:45 PM
#6
Fanatic Member
-
Apr 5th, 2007, 02:48 PM
#7
Thread Starter
Member
Re: VS2005: How to determine which node was double-clicked
Excellent. Thanks for the help.
-
Apr 5th, 2007, 02:48 PM
#8
Re: VS2005: How to determine which node was double-clicked
I just did some playing around with it and yes... you can set the selectedimage to the same thing as the item image. That way, the image does not change when you select something. I am guessing this is what you are trying to accomplish, if I am wrong please let me know.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|