M es imposible pensar/realizar un programa en el q yo l pase una ruta y el treeview me cree unos sub-nodos. Yo x ejemplo le paso una ruta en este formato "\carpeta\subcarpeta\y otra mas" y no se como acer para q m salga asi:
\
|---carpeta
|-----subcarpeta
|--------y otra mas
Alguien m podria poner un ejemplo?
Hola esto te puede servir
Private Sub Form_Load()
With TreeView1.Nodes
Set Root = .Add(, , , "Nombre")
.Add Root.Index, tvwChild, , "alejandro"
.Add Root.Index, tvwChild, , "alex"
.Add Root.Index, tvwChild, , "raul"
.Add Root.Index, tvwChild, , "carlos"
.Add Root.Index, tvwChild, , "maria"
.Add Root.Index, tvwChild, , "daniel"
Set Root = .Add(, , , "Coches")
.Add Root.Index, tvwChild, , "mercedez"
.Add Root.Index, tvwChild, , "bmw"
.Add Root.Index, tvwChild, , "honda"
.Add Root.Index, tvwChild, , "renault"
.Add Root.Index, tvwChild, , "opel"
Set Root = .Add(, , , "Pais")
.Add Root.Index, tvwChild, , "españa"
.Add Root.Index, tvwChild, , "alemania"
.Add Root.Index, tvwChild, , "francia"
.Add Root.Index, tvwChild, , "miami"
.Add Root.Index, tvwChild, , "ondura"
Set Root = .Add(, , , "Comer")
.Add Root.Index, tvwChild, , "vaca"
.Add Root.Index, tvwChild, , "pollo"
.Add Root.Index, tvwChild, , "pescado"
Set Root = .Add(, , , "Trabajo")
.Add Root.Index, tvwChild, , "construccion"
.Add Root.Index, tvwChild, , "soldador"
.Add Root.Index, tvwChild, , "carpintero"
End With
End Sub
ok espero que te sirva esto,
Lo q mejor m a funcionado es_
Public Sub AddFolder(Direccion As String, Tree As TreeView)
On Local Error Resume Next
Dim Separa() As String
Dim i As Integer
Dim Ruta As String
Dim Titulo As String
Separa = Split(Direccion, "\")
For i = 0 To UBound(Separa) - 1
If i = 0 Then Ruta = "\" Else Ruta = Separa(i)
Titulo = Separa(i + 1)
Tree.Nodes.Add Ruta, 4, Titulo, Titulo
Next i
End Sub
Bien no esta mal...