Ftp Object : Listing Property |
Visual Basic |
---|
Public Property Listing As ListEntries |
Private Sub Command1_Click() On Error Goto OnError ' use intrinsic error handling Ftp1.Timeout = 1000 Ftp1.List "*.txt" ' all text files are requested Dim TxtListing As ListEntries Set TxtListing = Ftp1.Listing ' increased usage count keeps object in memory Ftp1.List "*.exe" ' all executable files are requested Dim ExeListing As ListEntries Set ExeListing = Ftp1.Listing ' increased usage count keeps object in memory Exit Sub OnError: ' Any error jumps here Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description End Sub
Dim le1 As New ListEntries Dim le2 As New ListEntries Private Sub Command1_Click() On Error Goto OnError ' use intrinsic error handling Ftp1.Timeout = 1000 Ftp1.Listing = le1 ' get a listing from the current directory Ftp1.List Ftp1.Listing = le2 ' get a listing from the parent directory Ftp1.List "../" ' le1 and le2 now contain listings from 2 different directories Exit Sub OnError: ' Any error jumps here Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description End Sub