» Home » VB.NET Projects » TreeViewMultiCtrl Control

TreeViewMultiCtrl Control

Author: EiNSTeiN_  EiNSTeiN@g3nius.org
Created: Nov. 2007

What does this control do?

This user control allows you to create a TreeView control but, unlike VB.NET's Tree View, this one can display multiple columns. Additionally, this TreeView allows you to pack VB.NET controls in any of its columns (that is, any inheritant of System.Windows.Forms.Control).

Download it now!

ctrlTreeViewMultiCtrl-0.1-src.zip 11.68 KB

Please make sure you understrand the terms of our licence and that you agree to respect them.
If you don't agree to respect them, don't proceed with the download and leave this page now.

How to use it?

In the zip archive linked above, you will find the source code for the control. It also contains the images used in the tree view, but the images are stored as an internal resource in the form so you do not need to ship the images with your project. You can add the control to any project and then instanciate a ctrlTreeViewMultiCtrl object. The code below shows how to create a new instance of the control with four columns and three rows.

        Dim row1, row2 As ctrlTreeViewMultiCtrl.Row
        Dim tvmc As New ctrlTreeViewMultiCtrl

        tvmc.AddColumn("Column 1")
        tvmc.AddColumn("Column 2")
        tvmc.AddColumn("Column 3")
        tvmc.AddColumn("Column 4")

        tvmc.Head.SetControl(0, "Head Node")

        row1 = tvmc.Head.AddChild()
        row1.SetControl(0, "Sub Node 1")

        row2 = row1.AddChild()
        row2.SetControl(0, "Row 1")
        row2.SetControl(1, "Text 1")
        row2.SetControl(2, New DateTimePicker())
        row2.SetControl(3, "Sample 4")
        row2.Controls(3).ForeColor = Color.Red

        row2 = row1.AddChild()
        row2.SetControl(0, "Row 2")
        row2.SetControl(1, "Text 2")
        row2.SetControl(2, New DateTimePicker())
        row2.SetControl(3, "Sample 5")
        row2.Controls(3).ForeColor = Color.Green

        row1 = tvmc.Head.AddChild()
        row1.SetControl(0, "Sub Node 2")

        row2 = row1.AddChild()
        row2.SetControl(0, "Row 3")
        row2.SetControl(1, "Text 3")
        row2.SetControl(1, "Text 6")
        row2.SetControl(2, New DateTimePicker())
        row2.SetControl(3, "Sample 10")
        row2.Controls(3).ForeColor = Color.Yellow

And here's the result:


Although it is fully usable, this control lacks some functionalities, for example:

2007-2011, g3nius.org | support at g3nius dot org