473,320 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

I need help populating a treeview correclty

I have a dataset dsMain in which I have two tables

The table period has columns like period_id, name, root_org_id....
The table organization has org_id, name, parent_id, hier_path, level,
org_index, and period_id.

There is a one to many relationship between period and organization, but the
organization is actually a hierarchy.
period.root_or_id represents the org_id of the root node of the
organization hierarchy and that organization should be the first node of the
treeView.

In my application I have a combobox that I populate with the period data.
So when the form loads cmbPeriod.items[0] represents the first period. Its
ValueMember is the period_id of the first period and I currently use that
data with a parameterized query to fill or refill the organization table as
needed.

Once I have done that, however, I am not sure how to use the code to access
a specific record or the organization table to find the record associated
with the root_org_id.
1. I am not exactly sure how to access the root_org_id value of the
currently selected period item of the combobox.
2. I am not sure how to use that value to index into the organization table
to find the right record. I am guessing that you can use index like syntax
with tables and rows, but I have never tried it and I don't have any samples
to go by. I don't know how to set which column to index on.

After I get that done, then I need to develop an algorithm to build the rest
of the tree. I have seen recursive algorithms used with directory trees and
that might work, but I am not sure how I would tell I was at the leaf node.
There are a number of possible fields to use in the organization table, the
parent_id = -1 for the root node and has the value of its immediate parent
for all other nodes. The level field = 0 for the root node and increments
for all subsequent levels. The hier_path field is a string field in the
form "|0|1001|...|1005|" where the vertical bars are delimiters and the
values are text representation of the org_ids of that records and all its
ancestors.

Can someone please point me in the right direction?
Nov 17 '05 #1
0 1227

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: imassadpk | last post by:
Hi all, Apprecite your help in resolving this tricky issue... I am trying implementing Recurrsive TreeView in MS. Access 2003 ADP project. So far, no luck :( The Problem: This sample...
0
by: N-Mayne | last post by:
Hi i was wondering if anyone knew how to Populating a TreeView control with the contents of a class and varibles etc, like netbean does but in C#. Thanks Nick Posted Via Usenet.com Premium...
1
by: naijacoder naijacoder | last post by:
Hi Guys, I have an application below that is treeview menu populated from the database which works with asp.net webmatrix.But when i put it into code behind in Visual Studio.Net it gives the...
2
by: Steve Arndt | last post by:
I'm trying to populate a vb.net treeview using a SQLDataReader at Treeview1_BeforeExpand. Basically I have a Treeview with 5 parent nodes and 1 dummy child node per parent. The first parent node...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.