Endless Tree Level (Nodes)

niall29

Freshman
Joined
Sep 13, 2004
Messages
35
Hi
I hope somebody can help me but I want to make a treeview that can have endless levels.
I made my original tree which had 5 levels but now our company is growing and there are some depts that have 7 or 8 levels and growing.
I was using If Mang_ID = Person_ID in my tree is there away that I could make it instead of
(Example)
Childnode, childnode 2 etc I could make the number an integer and put it on a loop
In theory I think this should work but unfortunately I cant get it to work in practice.
Any help would be greatly appreciated.
 
This is easy...

Public Class Node
Private mNodes as NodeCollection
Public Readonly Property Nodes as NodeCollection
Get
return mNodes
End Get
End Property

End Class

Public Class NodeCollection
'
'
'Code to accomodate your nodes
'(like Add,Remove,Clear,Count,GetEnumerator,Item(Index) etc.)
End Class
 
Oh and if you are planning to load your nodes from a database then:
You should use the following Table

ID Int Primary Key
ParentID Int <- If 0 then this is a top level node
Whatever Other Fields


If u want to have a node load all its children u use this SQL Statement:

"Select * From Table Where ParentID = " & MyID & ";"
 
Actually that does seem to be what I am looking for. Let me see if I am understanding it.
I always had the whole tree populating at the form load but from what I understand is you populate it as you click the Parent node. If I am write how would that work on a search feature which should open the tree to show that employees position.
 
Back
Top