Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-10-27
2
Medium Priority
?
413 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 1000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

824 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