Solved

VB.net Treeview selection by mouse

Posted on 2006-10-30
2
349 Views
Last Modified: 2008-03-17
When I Click on a treeview I only want a treenode selected if the node was clicked on it's Icon, it's Label, or the plus/minus symbol.

 All Those situations work, however when the treeview is clicked in a Blank Area, the treenode that is on the same Y-axis as where the mouse was clicked becomes the selected node.  How can I prevent that from happening and only have the treenode be the selected node when the Icon, Plus/minus, or label is selected??

0
Comment
Question by:OFGemini
2 Comments
 
LVL 19

Accepted Solution

by:
VoteyDisciple earned 125 total points
ID: 17836830
I don't suppose setting FullRowSelect = False on the TreeView does it?  It's been a while since I've played extensively with a TreeView in .NET.

If not, you might try using the GetNodeAt() method to find the node at the point where the user clicked, though I'm guessing that would return a node for any locations that also result in selecting that node, so it wouldn't really gain you anything.
0
 

Author Comment

by:OFGemini
ID: 17837722
You're are right VoteyDisciple.  GetNodeAt() does exactly what I DO NOT want it to do.    

I made a change to my code and when I left click on the treeview it behaves as I want it to, but getNodeAt() does not.  I use getNodeAt to make a node the selected node if it is Right-Clicked.  I did that in my treeview mousedown event.  

Now I need to figure out how to Get the right click working correctly.
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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