CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2001
    Posts
    11

    Bulding a tree in VB

    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,



  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Bulding a tree in VB

    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
    [email protected]

    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
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Apr 2001
    Posts
    11

    Re: Bulding a tree in VB

    Thanks but not what I was looking for. I need a logical tree I can transverse.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured