Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Treeview query

Posted on 2001-08-20
2
Medium Priority
?
206 Views
Last Modified: 2012-05-07
Basically I want to use a treeview, but have never used one.  Yes I know you are asking what I have been doing all this time, but most of the the time I write server side code and not UI.  Anyways back to the point in hand......

I want to populate a tree view from the following table:

ID - primary key autonumber
Desc - eg. Liverpool V Man Utd (this is the field in the tree)
Parent ID - This will link back to the ID in a one to many / parent child type format.  Eg the example for desc will always be the parent, but a child could be robbie fowler to score the first goal etc etc.  Basically if you havent guessed, it is for a betting system.

So......if I have my table populated with all these parents and childs, then what properties do I have to use to get the tree looking somthing like:

Football
   Liverpool V Man Utd
      child info
      ........
   Another match
      .........
      .........
   Chelsea to win the league
Horse Racing
   Doncaster
      3.15pm
         Red Rum to win

etc etc

Cheers,

Ray.
etc etc


Also this is only a prototype, so the table design can be changed if you feel it necessary to answer my question.  If you have done something similar, but used a different table design then Im open to offers, as I just want the system up and running asap, and everything I am doing is flexible.
0
Comment
Question by:raybetts
[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
2 Comments
 
LVL 1

Accepted Solution

by:
beercat2 earned 400 total points
ID: 6407738
When you add a node to a TreeView, you need to set these properties:  an image (contained within an ImageList control), a key (a unique identifier for that node within the tree) and a label (what you want to see in the tree view).

The syntax for adding a node is as follows:
treeviewobject.Nodes.Add ([relative],[relationship],[key],[text],[image],[selected image]

So, if you were adding a parent object, such as "Liverpool V Man", you might say:
treeviewobject.Nodes.Add ,,1,"Liverpool V Man",image1

When adding a child, such as "Robbie Fowler to Score the First Goal", you might say:
treeviewobject.Nodes.Add "Liverpool V Man",tvwChild,2,"Robbie Fowler to Score the First Goal,image1

Obviously, you would probably want to use a recordset to dynamically fill the node text and key using data straight from the database rather than hardcode it.

This is the first time I've answered any questions, so bear with my attempt to explain this  :)  If you have any questions, let me know and I'll try to help out!

Brian
0
 
LVL 1

Author Comment

by:raybetts
ID: 6410800
Brian

I had figured it out today at work on how the treeview works (sometimes Im lazy and hate brick walls - hence the question) .  But seeing as your answer was to a high standard and its your first time then I will give you the points.

I also managed to fill the treeview from a rs using a little recursion, so again you were on the right track.

Keep up the good work.

Ray.
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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

636 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