?
Solved

Issue with Tree view conrol

Posted on 2009-04-10
2
Medium Priority
?
338 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
T0ni earned 1000 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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 course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

650 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