Help with VB6 code - TreeView object with 2 root nodes?

LeighWardle
LeighWardle used Ask the Experts™
on
Hi Experts,

I just got some sample code from vb_elmar that provided an example of one TreeView object with 2 root nodes.

When I changed the code to give me the hierarchy that I want, I do not get what I am after.

I want it to look like:
        Job
       ...Layered System
       
       Data
       ...Load Groups

My project is attached.

Regards,
Leigh
TreeView-object-with-2-root-node.zip
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Here is a sample.
3.zip

Author

Commented:
Hi vb_elmar,

Thanks, your sample gives the desired hierarchy.

Can you please do me a favour and explain the significance of the first parameter (1, 2 or 4 in the your sample) used in the .Nodes.Add statement?

Thanks,

Regards,
Leigh
Commented:
The 1st parameter of TreeView1.Nodes.Add stands for the horizontal distance to the root.

If there is more than one main node (main node is in red color) the 1st parameter increases by the parameter value of the last found node.first parameter

Author

Commented:
Thanks,  vb_elmar,

Your explanation is very clear - it's great to have a diagram,

Regards,
Leigh

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial