Question:
What are reasons of a error -1 in the method ChangeRemoteDir?
If sPath = "." Then newRelativePath = "/" newDisplayPath = newRelativePath ElseIf sPath = ".." Then If currentPath = "/" Then newRelativePath = "/" newDisplayPath = newRelativePath Else newRelativePath = getFolderFromPath(tvFolders.Nodes(1).Text, "/") If newRelativePath = "" Then newRelativePath = "/" End If newDisplayPath = newRelativePath End If ElseIf sPath = "../" Then 'This means to stay in the same path and just refresh newRelativePath = currentPath newDisplayPath = newRelativePath Else newRelativePath = sPath If currentPath.Substring(Math.Max(currentPath.Length - 1, 0)) = "/" Then newDisplayPath = currentPath & sPath Else newDisplayPath = currentPath & "/" & sPath End If End If
' Set the current directory (on the FTP server)
' When logging into an FTP account,
' current remote directory is automatically set to the
' home directory of the FTP account. From the FTP client's
' perspective, it will be "/", but the absolute path on the
' FTP server might be something like "/home/ftp_users/".
flSuccess = ftp.ChangeRemoteDir(newRelativePath)
If flSuccess <> 1 Then
SystemSounds.Beep.Play()
UpdateLogWithMessage(ftp.LastErrorText)
UpdateActionStatus("Display Directory Contents Error")
Me.Cursor = Cursors.Default
Exit Sub
End If
Look at the contents of the ftp.LastErrorText property to get information about what happened...