Ftp Object : NameList Method |
Visual Basic |
---|
Public Sub NameList( _ Optional ByVal PathName As String _ ) |
The Type property should be ftpAscii or ftpEbcdic. If ftpImage is specified, then lines may not terminate with a CR/LF, creating a formatting problem.
This method sequences and sends the ftpType, ftpPort or ftpPassive, and ftpNameList commands.
The Progress event fires as each reply is received. If Timeout is greater than 0, this method blocks until the listing is received from the server or a ptTimeout error occurs. If Timeout is 0, this method immediately returns.
This method may generate the following error code (refer to ErrorConstants for a complete list of error codes):
Private Sub Command1_Click() On Error Goto OnError ' use intrinsic error handling Ftp1.Login "ftp.dart.com", "anonymous", "powertcp" If Ftp1.State = tcpConnected Then MsgBox "Connected!" Exit Sub OnError: ' Any error jumps here Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description End Sub Private Sub Command2_Click() On Error Goto OnError ' use intrinsic error handling Ftp1.Timeout = 1000 Ftp1.NameList Text1.Text = Ftp1.Listing.Text ' show list of filenames to user Exit Sub OnError: ' Any error jumps here Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description End Sub