Solved

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

Posted on 2003-10-27
2
392 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

760 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

23 Experts available now in Live!

Get 1:1 Help Now