Solved

Preventing a TreeView control  from collapsing other nodes when selecting new node.

Posted on 2003-10-27
2
394 Views
Last Modified: 2013-12-26
I am getting increasingly frustrated by a peculiar (seemingly default) behavior of the TreeView control (Common Controls 6 version).

Say for example I create a tree with 3 nodes at the root level and 3 child nodes for each parent node. I run the project and use the + / - symbols to expand all three parent nodes. As soon as I click on one of the child nodes, the parent nodes of the other child nodes automatically collapse, leaving the minimum number of expanded nodes needed to provide a path to the selected node.

This behavior doesn't seem to exist in any program on the market which uses TreeViews, even Windows Explorer, but I can't for the life of me work out how to prevent it. Surely this must be driving other developers mad, and yet I can find nothing about it anywhere on the web. Please help!

Behaviour definitely occurs under Windows 2000 and XP using Visual Basic 6, Service Pack 5.
0
Comment
Question by:wwarby
2 Comments
 
LVL 39

Accepted Solution

by:
appari earned 250 total points
ID: 9630855

i think your treeview controls SingleSel property is set to true. change it to false and check.
0
 
LVL 1

Author Comment

by:wwarby
ID: 9630919
Absolutely correct. I can't believe I didn't check what that property actually did - it just seemed so obvious... SingleSel, prevent multiple nodes from being selected at the same time, like the MultipleSelection property of the ListView control. Why they hell did Microsoft call is SingleSel anyway? Thanks a lot mate, you've put 6 months of frustration to sleep in a single sentence. Points well deserved, however easy the answer ended up being!
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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 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

18 Experts available now in Live!

Get 1:1 Help Now