Solved

Tree View in VB6

Posted on 2004-08-17
3
329 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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 …
Simple Linear Regression

695 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