Solved

VB.net Treeview selection by mouse

Posted on 2006-10-30
2
344 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 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

26 Experts available now in Live!

Get 1:1 Help Now