Stacklysm
Stacklysm

Reputation: 278

TreeNode when double-clicked is recognized as TreeView

I was having problems with handling TreeNode double-click event calls, so I had the event code to display a MessageBox with the type of the object that was double-clicked. This was the result:

MessageBox showing the bug

The event used was NodeMouseDoubleClick, any suggestions?
Using .NET Framework 4.7.2, C# 7.3 and Visual Studio 2019 Preview 1

Upvotes: 0

Views: 586

Answers (1)

Robert Harvey
Robert Harvey

Reputation: 180777

Normally Microsoft's convention for events like these is to put the top-level object in the sender parameter of the event, which would be the TreeView. If you want the node you clicked on, look for the Node property in the TreeNodeMouseClickEventArgs.

Upvotes: 3

Related Questions