Solved

Tree View in VB6

Posted on 2004-08-17
3
299 Views
Last Modified: 2010-04-17
I need the code to view data in a database in the tree format, Kindly help
0
Comment
Question by:Ravi_Aces
3 Comments
 
LVL 2

Accepted Solution

by:
kouroshparsa earned 250 total points
ID: 11825161
Step1: Add a TreeView control to you form.
Step2: In the load method of the form, add the data to the TreeView
Example:
'TreeView1 is the name of the TreeView:

Private Sub Form_Load()
Dim i As Integer
Dim factory As Node
Dim group As Node
Dim person As Node

    ' Create some nodes.
    Set factory =TreeView1.Nodes.Add(, , "f R & D", "R & D")
    Set group = TreeView1.Nodes.Add(factory, tvwChild, "g Engineering", "Engineering")
    Set person = TreeView1.Nodes.Add(group, tvwChild, "p Cameron, Charlie", "Cameron, Charlie")
    Set person = TreeView1.Nodes.Add(group, tvwChild, "p Davos, Debbie", "Davos, Debbie")
    person.EnsureVisible
    Set group = TreeView1.Nodes.Add(factory, tvwChild, "g Test", "Test")
    Set person = TreeView1.Nodes.Add(group, tvwChild, "p Able, Andy", "Andy, Able")
    Set person = TreeView1.Nodes.Add(group, tvwChild, "p Baker, Betty", "Baker, Betty")
    person.EnsureVisible
   
    Set factory = TreeView1.Nodes.Add(, , "f Sales & Support", "Sales & Support")
    Set group = TreeView1.Nodes.Add(factory, tvwChild, "g Showroom Sales", "Showroom Sales")
    Set person = TreeView1.Nodes.Add(group, tvwChild, "p Gaines, Gina", "Gaines, Gina")
    person.EnsureVisible
    Set group = TreeView1.Nodes.Add(factory, tvwChild, "g Field Service", "Field Service")
    Set person = TreeView1.Nodes.Add(group, tvwChild, "p Helms, Harry", "Helms, Harry")
    Set person = TreeView1.Nodes.Add(group, tvwChild, "p Ives, Irma", "Ives, Irma")
    Set person = TreeView1.Nodes.Add(group, tvwChild, "p Jackson, Josh", "Jackson, Josh")
    person.EnsureVisible
    Set group = TreeView1.Nodes.Add(factory, tvwChild, "g Customer Support", "Customer Support")
    Set person = TreeView1.Nodes.Add(group, tvwChild, "p Klug, Karl", "Klug, Karl")
    Set person = TreeView1.Nodes.Add(group, tvwChild, "p Landau, Linda", "Landau, Linda")
    person.EnsureVisible


    TreeView1.Nodes(1).EnsureVisible
End Sub
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
add text to end of existing text in file 16 62
wordlen challenge 3 47
creating threads in delphi 1 54
SUM 2 INTEGER ARRAYS INTO 1 10 59
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now