Solved

Tree View in VB6

Posted on 2004-08-17
3
308 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exchange and Third Party application. 8 68
tidtcpserver connection lost handle 2 70
parse convert xml feed to text (python) 2 67
Regular Expression Calculator Tester 2 48
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
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 …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

914 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

15 Experts available now in Live!

Get 1:1 Help Now