Xceed .NET Libraries Documentation
Xceed.Ftp Assembly / Xceed.Ftp Namespace / FtpClient Class / Disconnected Event
Example


In This Topic
    Disconnected Event (FtpClient)
    In This Topic
    Raised when the Disconnect method is called as well as when the connection is terminated by the FTP server.
    Syntax
    'Declaration
     
    Public Event Disconnected As EventHandler
    'Usage
     
    Dim instance As FtpClient
    Dim handler As EventHandler
     
    AddHandler instance.Disconnected, handler
    public event EventHandler Disconnected
    Example
    The following example demonstrates how to use the Disconnected event to display a messagebox when the FTP client is disconnected from the FTP server. This example assumes that you are in a Windows application.
    Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" ' Set license key here to deploy 
    
    Dim ftp As New FtpClient()
    
    AddHandler ftp.Disconnected, AddressOf Me.disconnected
    
    ftp.Connect( "localhost" )
    ftp.Login()
    
    ftp.GetFolderContents()
    
    ftp.Disconnect()
    
    Private Sub disconnected( ByVal sender As Object, ByVal e As EventArgs )
    
      MessageBox.Show( "You are no longer connected to the FTP server!" )
    End Sub
    Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" // Set license key here to deploy 
    
    FtpClient ftp = new FtpClient();
    
    ftp.Disconnected += new EventHandler( this.disconnected );
    
    ftp.Connect( "localhost" );
    ftp.Login();
    
    ftp.GetFolderContents();
    
    ftp.Disconnect();
    
    private void disconnected( object sender, EventArgs e )
    {
      MessageBox.Show( "You are no longer connected to the FTP server!" );
    }
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also