Solved

Treeview query

Posted on 2001-08-20
2
193 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 100 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
using Access 8 93
Using "ScreenUpdating" 6 86
Notepad++ how to remove delimiter : from beggning of the line? 3 135
Export PDF Form fields to Access  or Excel  in Tab order 16 128
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

734 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