1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
''' <summary>
''' Parcours récursif des noeuds d'un treeview pour sélectionner le lien actif dans la navigation
''' </summary>
''' <param name="n"></param>
''' <param name="currentURL"></param>
''' <returns></returns>
''' <remarks>La recherche se stoppe dés qu'un lien copatible est trouvé.</remarks>
Private Function SetActiveNode(ByVal n As TreeNode, ByVal currentURL As String) As Boolean
If n.NavigateUrl IsNot Nothing Then
If CheckLink(n.NavigateUrl, currentURL) Then
n.SelectAction = TreeNodeSelectAction.None
n.Selected = True
Return True
Exit Function
End If
End If
If n.ChildNodes.Count > 0 Then
Dim n2 As TreeNode
For Each n2 In n.ChildNodes
If SetActiveNode(n2, currentURL) Then
Return True
Exit Function
End If
Next
End If
Return False
End Function |