?
Solved

Building a relationship tree in vb

Posted on 2009-02-20
5
Medium Priority
?
179 Views
Last Modified: 2013-12-25
Hello

I am developing a windows application in VB,  In which i store all the contact information, it is like an address book. I have to take the information about the relation ship between the person(whose information is being stored) and himself... Like whether he is a superior  or a subordinate or just an employee... Now based on this information, i need to build a 2D tree view which shows his superiors above him and subordinates below him. Now, how can i build this tree??? It has to take the information from the database and display the tree..
Please advise...


Priya
0
Comment
Question by:Priyadarshni
  • 3
  • 2
5 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 23690963
I have done that for family relationships with a Treeview control. However, the hierarchy goes across the page instead of down the page, so that might not suit you.
0
 

Author Comment

by:Priyadarshni
ID: 23691466
Ya... I do need a top down tree... But will i be able to modify your code to suit my requirements?
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 23691738
Possibly, but it is rather specialised. In principle it is recursive search. This is some pseudocode.

Usage is: Call TopBossID, 1

Sub GetReportees(MemberID, Level)
    sgl = select * from mytable where BossID= MemberID
    rs.open sql
    do until rs.eof
           AddToTree Member, Level
           GetReportees MemberID, Level+1
           rs.MoveNext
    Loop
end sub
0
 

Author Comment

by:Priyadarshni
ID: 23732973
i am taking the data from the database and then checking the relation. Based on that relation i need to buid a tree...can i use recursion here?
0
 

Author Closing Comment

by:Priyadarshni
ID: 31568532
I was able to use recursive tree
0

Featured Post

Technology Partners: 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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

840 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