Solved

Issue with Tree view conrol

Posted on 2009-04-10
2
324 Views
Last Modified: 2013-12-17
Hi,
I want to use context menu in TreeView control. I implemented a event method for OnMouseClick and then checking if the button was right clicked. if the button is right mouse button i am displaying a message box. This is done just for tesing.
This works fine if i have some nodes in tree view control and right click on some node. But if there are no nodes in the tree view and if i do a right click, the event is not being handled!!! Can you please tell me how to solve this issue.
I am Implementing the tree view so that if i right click on the tree view, i should get a context menu. from the context menu, i should be able to add, remove, rename the nodes and sub-nodes. Since currently no nodes are present the event is not at all handled and i am unable to display the context menu.
Please help me solving this issue.

Thanks
0
Comment
Question by:yamurthy
2 Comments
 
LVL 2

Accepted Solution

by:
T0ni earned 250 total points
Comment Utility
Hi yamurthy,

If the treeview is empty with absolutely no treenodes, then I think this should be the way to go:
1) Create a contextMenuStrip
2) From the treeview's property grid set the ContextMenuStrip property to the contextMenuStrip that you have just created.

Now when ever you click on the treeview the context menu will appear.
ContextMenuStrip.jpg
0
 
LVL 1

Author Closing Comment

by:yamurthy
Comment Utility
Initially i did check for contextMenustrip in the treeview properties. but did not add the strip from the tool box!!!. was just looking in the properties and was wondering that it was just (none) and nothing else. :)
Thanks a lot for the answer
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now