niall29 Posted February 7, 2005 Posted February 7, 2005 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. Quote
IcingDeath Posted February 7, 2005 Posted February 7, 2005 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 Quote
IcingDeath Posted February 7, 2005 Posted February 7, 2005 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 & ";" Quote
IcingDeath Posted February 7, 2005 Posted February 7, 2005 if this is not what u want then just be more specific... Quote
niall29 Posted February 7, 2005 Author Posted February 7, 2005 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.