Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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

Posted

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 & ";"

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...