J'ai avancé dans la réalisation mais il me manque pas grand chose.
Voici le code
Private Sub AddNode(ByRef oTree As TreeNode, ByVal id_parent As String, ByVal id_child As String, ByVal html As String, ByVal expanded As String, ByVal icon As String)
Dim childNode As New TreeNode
Dim int As Integer
childNode.Nodes.Clear()
childNode.Text = html
childNode.ID = id_child
childNode.Expanded = expanded
If id_parent = "root" Then
oTree.Nodes.Add(childNode)
Else
'RetournerNoeud(oTree, id_parent).Nodes.Add(childNode)
End If
childNode = Nothing
End Sub
Public Function RetournerNoeud(ByVal oTree As TreeNode, ByVal wKey As String) As TreeNode
Dim i As Integer
Dim str As String
RetournerNoeud = Nothing
For i = 0 To oTree.Nodes.Count
If oTree.Nodes(i).ID = wKey Then
RetournerNoeud = oTree.Nodes(i)
Exit Function
Else
If oTree.Nodes(i).Expanded = True Then
RetournerNoeud(oTree.Nodes(i), wKey)
Exit For
End If
End If
Next
End Function
J'ai un soicis dans la partie en rouge cela ne fonctionne pas correctement.
Pour être plus clair voici ma démarche
PageLoad
Ajout du noued racine au Treeview
Parcours du tableau contenant les noeud
Ajout le noeud au noeud racine
AddNode
initialisation du noeud fils
Ajout le noeud au noeud Parent
recherche noeud
Parcour du noeud racine
si l'identifiant est égale à l'identifiant du noeud rechercher
on retourne le noeud correspond
sinon
si le noeud peut être parent a son tour
on recherche le noeud dans le sous arbre
Aidez moi SVP je galère pas mal Meci d'avance