RE:como puedo trabajar con el tree view
UPS !!! Se me olvido parte del código' Declara variables globales
Dim indrag As Boolean ' Indicador de operación arrastrar y colocar.
Dim nodX As Object ' Elemento arrastrado.
Private Sub Form_Load()
' Carga un mapa de bits en un control Imagelist.
Dim imgX As ListImage
Dim BitmapPath As String
BitmapPath = "icons\mail\mail01a.ico"
Set imgX = imagelist1.ListImages.Add(, , LoadPicture(BitmapPath))
' Inicializa el control TreeView y crea varios nodos.
TreeView1.ImageList = imagelist1
Dim nodX As Node ' Crea un árbol.
Set nodX = TreeView1.Nodes.Add(, , , "Primario 1", 1)
Set nodX = TreeView1.Nodes.Add(, , , "Primario 2", 1)
Set nodX = TreeView1.Nodes.Add(1, tvwChild, , "Secundario 1", 1)
Set nodX = TreeView1.Nodes.Add(1, tvwChild, , "Secundario 2", 1)
Set nodX = TreeView1.Nodes.Add(2, tvwChild, , "Secundario 3", 1)
Set nodX = TreeView1.Nodes.Add(2, tvwChild, , "Secundario 4", 1)
Set nodX = TreeView1.Nodes.Add(3, tvwChild, , "Secundario 5", 1)
nodX.EnsureVisible ' Expande el árbol para mostrar todos los nodos.
End Sub
Private Sub TreeView1_MouseDown _
(Button As Integer, Shift As Integer, x As Single, y As Single)
Set nodX = TreeView1.SelectedItem ' Elemento arrastrado.
End Sub
Private Sub TreeView1_MouseMove _
(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then ' Operación de arrastre.
indrag