Loading Data from Access into a Treeview

S

SeVeN

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!!
 
C

Cor Ligthert [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top