The new vbAccelerator Site - more VB and .NET Code and Controls
Source Code
2 Common Controls Library &nbsp

TreeView Control

A seriously flexible, all VB TreeView control with support for IE Favorites and Outlook Folder List Styles

NOTE: this code has been superceded by the version at the new site.

Various TreeView Styles

Download Code
VB5 code VB5 Control Binary (36kb) VB6 code VB6 Control Binary (36kb)
VB5 code VB5 Demonstration Project (40kb) VB6 code VB6 Demonstration Project (40kb)
VB5 code VB5 Full Source Code (112kb) VB6 code VB6 Full Source Code (113kb)
Required Files:
  • vbAccelerator SSubTmr.DLL for VB5
  • vbAccelerator VB5 ImageList control
  • Ole Guids and Interface Definitions type library (OleGuids.TLB)
  • IShellFolder Extended Type Library v1.2 (ISHF_Ex.TLB)
  • Required Files:
  • vbAccelerator SSubTmr6.DLL for VB6
  • vbAccelerator VB6 ImageList control
  • Ole Guids and Interface Definitions type library (OleGuids.TLB)
  • IShellFolder Extended Type Library v1.2 (ISHF_Ex.TLB)

  • &nbsp UpdatedUpdated! 21 March 2000 &nbsp
    &nbsp A great update from Dan Litwin - now the control supports drag-drop of nodes and the IE Favourites style has been greatly improved. &nbsp
    &nbsp Source Code Note &nbsp
    &nbsp This OCX is a binary compatible component which works with all other samples. If you compile your own copy of this OCX yourself please make sure you change the name. See disclaimer and license for more details. &nbsp

    The TreeView control is an exceptional piece of code courtesy of Dan Litwin ( ; can also be found masquerading as "Dan Litwin" on AOLIM).

    Dan rose to my challenge of implementing a TreeView in VB right back in June, unfortunately I then sat on it for 4 months occasionally doing a bit of debugging before finally getting around to releasing it here. My apologies to everyone, hope it was worth the wait!

    • Internet Explorer Favorites style view.
    • Append a number to any node, allowing you to create an Outlook style folder list with message counts.
    • Choose Font and Colour on an item-by-item basis, and set the control's back colour.
    • Bolding of items
    • InfoTip (multi-line tooltip) support with full control over InfoTip colour
    • Works with Microsoft or API ImageLists.
    • Item check boxes
    • Full-Row select mode
    • Single-Click expand mode
    • Supports Two Images per item: one standard icon and a state icon.
    • Disable Custom Draw for maximum speed
    • Speed-optimised Clear method
    Coding With the TreeView Control
    The standard VB TreeView control uses an object model structure to navigate around the elements of the tree, which are described as Nodes. Nodes can be identified either by a Key, a 1 based Index, or by their relationship to another Node. Identifying Nodes by their index is slow because the control must enumerate through all items to find the appropriate index.

    This Tree control provides a flat model instead, so all items can be referred to directly without intermediate object stages. Tree items can be identified either by a Key or their Handle, which is the API hItem of the item within the Tree, or though their relationship with other items.

    Documentation for the TreeView control's properties, methods and classes is available as an RTF. This documentation was created with the Active X Documenter.
    Click here to download/view the TreeView control method and event documentation

    TopBack to top
    Source Code - What We're About!Back to Source Code


    AboutContributeSend FeedbackPrivacy

    Copyright 1999-2000, Steve McMahon ( All Rights Reserved.
    Last updated: 21 March 2000