OVH Cloud OVH Cloud

Treeview

1 réponse
Avatar
Jean Naimard
Bonjour,

Dans un treeview, je voudrais parcourir tous les fils d'un node par un
click.
L'exemple suivant ne fonctionne pas.
Merci de votre aide

Private Sub TreeView1_NodeClick(ByVal Node As Node)
Dim strText As String
Dim n As Integer.
n = Node.FirstSibling.Child.Index
strText = Node.FirstSibling.Child.Text & vbLf
While n <> Node.LastSibling.Child.Index
strText = strText & TreeView1.Nodes(n).Next.Text & vbLf
n = TreeView1.Nodes(n).Next.Index
Wend
MsgBox strText
End Sub

1 réponse

Avatar
Jacques93
Jean Naimard a écrit :
Bonjour,

Dans un treeview, je voudrais parcourir tous les fils d'un node par un
click.
L'exemple suivant ne fonctionne pas.
Merci de votre aide

Private Sub TreeView1_NodeClick(ByVal Node As Node)
Dim strText As String
Dim n As Integer.
n = Node.FirstSibling.Child.Index
strText = Node.FirstSibling.Child.Text & vbLf
While n <> Node.LastSibling.Child.Index
strText = strText & TreeView1.Nodes(n).Next.Text & vbLf
n = TreeView1.Nodes(n).Next.Index
Wend
MsgBox strText
End Sub





N'étant pas sûr de ta demande, peut être :

Dim strText As String
Dim n As Node

Set n = Node.Child
strText = Node.Child.Text & vbLf
While Not TreeView1.Nodes(n.Index).Next Is Nothing
strText = strText & TreeView1.Nodes(n.Index).Next.Text & vbLf
Set n = TreeView1.Nodes(n.Index).Next
Wend
MsgBox strText


--
Cordialement,

Jacques.