Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

713 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