Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Populate a Treeview
Message
From
13/03/2000 02:25:38
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00343015
Message ID:
00344869
Views:
26
Hi Pete,
Here is a simple code for your problem (If I understand you well of course :-)
There are two tables:
CUSTOMERS & ORDERS, table ORDERS is ordered by Customers

SELECT Customers
GO TOP
o = ThisForm.oleTree
uniq_key = 0
SCAN
uniq_key = uniq_key + 1
oNode = o.nodes.add(,1,ALLTRIM(STR(uniq_key))+"_",ALLTRIM(CustName),,)
oNode.Image = "Closed"
oNode.ExpandedImage = "Opened"
SELECT ORDERS
SEEK Customers.Code
get_key = uniq_key
SCAN WHILE Customer == Customers.Code
unic_key = unic_key + 1
oNode = o.nodes.add(ALLTRIM(STR(get_key))+"_",4,ALLTRIM(STR(uniq_key))+"_", ALLTRIM(Orders.Name),,)
oNode.Image = "Closed"
oNode.ExpandedImage = "Opened"
ENDSCAN
SELECT Customers
ENDSCAN

HTH
Boris
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform