Rank: Member Groups: Member
Joined: 5/20/2008 Posts: 12
|
I had a hard time finiding nodes so I wrote this and maybe EO should add to tree component.
The 2nd function is a recursive call to search entire tree not called directly by code in most cases.
Function FindNodeByValue(ByVal Tree As EO.Web.TreeView, ByVal inValue As String) As EO.Web.TreeNode
FindNodeByValue = Nothing For Each tnode As EO.Web.TreeNode In Tree.Nodes
If Trim(inValue) = Trim(tnode.Value) Then FindNodeByValue = tnode Exit Function End If FindSubNodeByValue(tnode, inValue, FindNodeByValue) If FindNodeByValue IsNot Nothing Then Exit Function End If
Next End Function
Sub FindSubNodeByValue(ByVal Node As EO.Web.TreeNode, ByVal inValue As String, ByRef NodeRef As EO.Web.TreeNode)
For Each tnode As EO.Web.TreeNode In Node.SubGroup.Nodes If Trim(inValue) = Trim(tnode.Value) Then NodeRef = tnode Exit Sub End If FindSubNodeByValue(tnode, inValue, NodeRef) If NodeRef IsNot Nothing Then Exit Sub End If Next End Sub
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
These two functions are very useful. Thanks for sharing in the forum!
|