Solved

Issue with Tree view conrol

Posted on 2009-04-10
2
327 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
ID: 24114557
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
ID: 31568840
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PrintingFoundIt(Almost!(Damn!)) 1 27
start a process from a service 3 23
No Data for DropDown List 2 26
Can't disable touch pad on Windows 10 computer 16 33
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

810 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