Click to See Complete Forum and Search --> : Bulding a tree in VB


rutledj
May 2nd, 2001, 01:25 PM
Can anyone show me code on how to build a tree of nodes recursively?

I have something that looks like this:

[AND[OR
[IN,@GeoCounty,%GeoCounty]
[IN,@GeoRegion,%GeoReion]
]
[OR
[IN,@Date1,@Date2]
[IN,%TimeMonth]
]
]

The AND'S, OR'S ,IN'S are the node name. the info after each comma is the data in the node.

So AND is root
OR is 1st descendant
1st IN is descendant of OR with @GeoCounty as its data.
2nd IN is descendant of same OR with @GeoRegion as its data.
Next OR is 2nd descendant of AND. etc.

Thanks,

Cakkie
May 3rd, 2001, 02:12 AM
I hope this is what you mean (don't shoot me if it isn't)
Use the treeview control:

TreeView1.Nodes.Add , , "AND", "AND"
TreeView1.Nodes.Add "AND", tvwChild, "OR1", "OR"
TreeView1.Nodes.Add "OR1", tvwChild, "IN1", GeoCounty
TreeView1.Nodes.Add "OR1", tvwChild, "IN2", GeoRegion
TreeView1.Nodes.Add "AND", tvwChild, "OR2", "OR"
TreeView1.Nodes.Add "OR2", tvwChild, "IN3", Date1
TreeView1.Nodes.Add "OR2", tvwChild, "IN4", Date2
TreeView1.Nodes.Add "OR2", tvwChild, "IN5", TimeMonth




Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

rutledj
May 3rd, 2001, 05:42 AM
Thanks but not what I was looking for. I need a logical tree I can transverse.