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
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
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.
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
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