Loading Data from Access into a Treeview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SeVeN

    #1

    Loading Data from Access into a Treeview

    Hello All,

    I am having a problem loading nodes and child nodes into a treeview
    from an access database.
    My Db fields are as follows :

    ID
    NodeName
    ParentID

    Everything works well when the child nodes are created after the parent
    nodes. Ex :

    ID NodeName ParentID
    1 Node1 -1
    2 Node2 1
    3 Node3 2

    My treeview enables the Drag and drop feature so when I move some nodes
    around the ParentID changes. If the Parent ID is pointing to a node
    that is not added yet to the treeview it will mess up.
    Ex:
    ID NodeName ParentID
    1 Node1 -1
    2 Node2 3
    3 Node3 1

    I can't seem to figure out the best way to code this to be able to get
    the childs in they're parent nodes no matter what order they are listed
    in the database.

    Can anyone help? Thanks!!

  • Cor Ligthert [MVP]

    #2
    Re: Loading Data from Access into a Treeview

    SeVeN,

    To use a treeview there has to be at least one parent child relation

    Parent1
    child1
    child2
    Parent2
    child2

    I don't see the parent child relation in your description of your problem?

    Cor


    Comment

    Working...