I spent several hours trying to figure this out and the code is posted in this forum under connection problem. I seen several other people facing the same problem so I will post it here for anyone else facing the same delema. Put this in your button connect click event. Thank Hans for his help in this. I have commented it to use with a listbox or listview but could easily be used also in a treeview control. I put this here so when you search GetFileInfos or GetFiles it will be easier to locate.
Try
' Clear the list-box or in my case the listview control
lvDirs.Items.Clear()
Dim myFile As EnterpriseDT.Net.Ftp.FTPFile
Dim myFTP As New EnterpriseDT.Net.Ftp.FTPConnection
With myFTP
' Set up connection properties
.ServerAddress = txtServer.Text
.UserName = txtUsername.Text
.Password = txtPassword.Text
' Connect to the server
.Connect()
' Loop through the entire file and directories listing
For Each myFile In myFTP.GetFileInfos
' Check to see if file is a directory if so add its name to the listbox
If myFile.Dir Then
'Use this senerio for a listbox
'Listbox.Items.Add(myFile.Name)
'or this senerio for listview control
'Where you must supply an imagelist in listview > Properties
'Image index 0 is a closed folder icon but can be whatever Icon you want.
'Also in my case I used listview > View > List
'listview > SmallImageList > myImageList
Dim lvDetails As New ListViewItem
lvDetails.ImageIndex = 0
lvDetails.SubItems(0).Text = myFile.Name
lvDirs.Items.Add(lvDetails)
End If
Next
' Don't forget to close the connection
.Close()
End With
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Cursor = Cursors.Default