Hi
I have a treeview, a button and a textbox. When you click button1 a folderbrowserdialog opens and after choosing the folder the path to the folder and anything in it is show in the textbox and with this code:
adapted from http://www.vbdotnetforums.com/listviews-treeviews/34336-major-treeview-list-view-head-ache.html I managed to make the treeview display the folder and the sub folders... but it isn't very hierarchial. Check attached pictures. Image1 shows how it is and image2 shows how I want it to be. Can anyone tell me how to get it to look like image 2?...Image2 was made in Windows Explorer. Image1 is a screenshot of the runing program that I am trying to make. I have been googling around but no luck so far. Practically I think what I shoul be asking is how to create child nodes of subfolders. Correct me if these aren't the proper terms I am relatively new to programming. The program is going to copy whatever the user checks in the treeview into another folder chosen by the user. I am using Visual Basic 2008 Express.
Thanks in advance.
I have a treeview, a button and a textbox. When you click button1 a folderbrowserdialog opens and after choosing the folder the path to the folder and anything in it is show in the textbox and with this code:
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sDirs() As String
Dim Dir
Dim fdlg As FolderBrowserDialog = New FolderBrowserDialog()
If fdlg.ShowDialog() = DialogResult.OK Then
TextBox1.Text = fdlg.SelectedPath
End If
Dim i As Integer
Dir = TextBox1.Text
sDirs = System.IO.Directory.GetDirectories(Dir)
For i = 0 To UBound(sDirs)
TreeView1.Nodes.Add(sDirs(i))
Next
End Sub
Thanks in advance.