TreeView Problem

Posted on 2005-05-02
Medium Priority
Last Modified: 2010-04-16
Language: C#
App Type: Windows application

this is very simple question if you knew it ...

I have a treeView on a windows form. the tree is somethting like this:


when i load the form, the tree is like this -- show all child notes, grand child notes ... what I want is that when I load the form, show a "closed" tree, like this:


only when user click the [+] and then it displays the child notes ...

What preperty i need set to the treeview in order to get a "closed" tree?

Question by:vbwang

Expert Comment

ID: 13914000

 The treeview has a function called CollapseAll() that collapses all the nodes. You could call it in your InitializeComponent procedure

Author Comment

ID: 13914420
I tried using this code, but it does't work.

... something code here display notes

Accepted Solution

boy8964 earned 80 total points
ID: 13914480
make sure treeView1.CollapseAll(); must be end of the display tree code. eg.

... show note1
..........show child note1
...........show child note2
... show note2
... show note3

the code treeView1.CollapseAll() must at end of the display tree code!
LVL 20

Expert Comment

ID: 13915825
Or you can call Collapse() for every node you want to close, e.g. only for the root node. Again: after adding its child nodes

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

864 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