treeview

M

Maarten

hi all,

i found this code earlier in this group.

now is my question how t handle this code

private sub form1_load(....)

dim fullpath as string = "C:\Documents and Settings\Maarten\My Documents\PLC
prog\Domo\" & Projectname

BuildNodeList(fullpath, ???)

end sub

what do i have te fill in in the questionmarks?





Private Sub BuildNodeList(ByVal currentPath As String, ByVal children As
TreeNodeCollection)

If currentPath.StartsWith(System.IO.Path.DirectorySeparatorChar) Then

ElseIf currentPath.StartsWith(System.IO.Path.AltDirectorySeparatorChar) Then

currentPath = currentPath.Substring(1)

End If

Dim paths() As String

paths = currentPath.Split(System.IO.Path.DirectorySeparatorChar,
System.IO.Path.AltDirectorySeparatorChar)

For Each path As String In paths

Dim child As TreeNode = Nothing

For Each child In children

If child.Text = Path Then

Exit For

End If

Next

If child Is Nothing OrElse child.Text <> Path Then

child = children.Add(Path)

If System.IO.Path.HasExtension(Path) Then

'file

child.ImageIndex = 2

child.SelectedImageIndex = 2

Else

'folder

child.ImageIndex = 1

child.SelectedImageIndex = 1

End If

End If

children = child.Nodes

Next

End Sub
 
H

Herfried K. Wagner [MVP]

Maarten said:
now is my question how t handle this code

private sub form1_load(....)

dim fullpath as string = "C:\Documents and Settings\Maarten\My
Documents\PLC prog\Domo\" & Projectname

BuildNodeList(fullpath, ???)

Use 'TreeView1.Nodes' instead of "???".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top