Tema: Treeview
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/11/2012, 10:11
boeing763
 
Fecha de Ingreso: noviembre-2012
Mensajes: 12
Antigüedad: 11 años, 5 meses
Puntos: 0
Treeview

Hola a todos!!
Soy nuevo en el foro y estudiante de DAI.
Estoy usando un treeview y mostrar en Msgbox si el nodo seleccionado tiene padre y si tiene nodos anteriores o posteriores.
Para ello uso la propiedad tag y los controles nextnode, prevnode, lastnode... pero no funcionan.
Es un nodo proncipal con tres "hijos"
Si lo hago en el primer hijo, sólo consigo que se muestre el padre, y el siguiente, pero no el último, osea el tercer "hijo".

Estoy aprendiendo poco a poco y estoy muy trabado con esto.

Gracias de antemano!!

Private Sub PrintRecursive2(ByVal n As TreeNode)

If n.Checked = True Then
If n.Tag = "padre" Then
MsgBox(n.Nodes(0).Text & " y " & n.Nodes(1).Text & " y " & n.Nodes(2).Text, MsgBoxStyle.Information, "Hijos")
End If

If n.Tag = "hijo1" Then
MsgBox(n.Parent.Text, MsgBoxStyle.Information, "Padre")
MsgBox(n.NextNode.Text, MsgBoxStyle.Information, "Siguiente")
MsgBox(n.LastNode.Text, MsgBoxStyle.Information, "Último")
Éste es el que no funciona con lastnode
End If

If n.Tag = "hijo2" Then
MsgBox(n.Parent.Text, MsgBoxStyle.Information, "Padre")
MsgBox(n.PrevNode.Text, MsgBoxStyle.Information, "Anterior")
MsgBox(n.NextNode.Text, MsgBoxStyle.Information, "Siguiente")
End If

If n.Tag = "hijo3" Then
MsgBox(n.Parent.Text, MsgBoxStyle.Information, "Padre")
MsgBox(n.PrevNode.Text, MsgBoxStyle.Information, "Anterior")
MsgBox(n.FirstNode.Text, MsgBoxStyle.Information, "Primero")
Y éste también me falla, el de firstnode
End If
End If

Dim aNode As TreeNode
For Each aNode In n.Nodes
PrintRecursive2(aNode)
Next
End Sub