Xceed FTP Library Documentation
Listing a remote folder's contents (VB.NET example)
Example topics > Listing a remote folder's contents (VB.NET example)
VB.NET Copy Code

Dim ftp As New XceedFtpLib.XceedFtpClass()
ftp.License( "your license key" )

' Specify the FTP server's address
ftp.ServerAddress = "ftp.cdrom.com"

' Specify the username and password to login
ftp.UserName = "anonymous"
ftp.Password = "guest"

Try
   ' Connect to the FTP server
   ftp.Connect()

   ' Subscribe to the ListingFolderItem event in order
   ' to display the contents of remote folder.
   AddHandler ftp.ListingFolderItem, AddressOf Me.ftp_ListingFolderItem
       
   ' List the root folder's content
   ftp.ListFolderContents( "" )

   ' Disconnect from the FTP server
   ftp.Disconnect()

Catch except As System.Runtime.InteropServices.COMException
   MessageBox.Show( except.ToString() )
End Try

' In this event we will right the name of each item into a listbox located on our form.
Private Sub ftp_ListingFolderItem( ByVal name As String, ByVal itemDate As DateTime, ByVal fileSize As Integer, ByVal itemType As XceedFtpLib.EXFFolderItemType, ByVal userData As String )
   listBox1.Items.Add( name )
End Sub