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


In This Topic
    StateChanged Event
    In This Topic
    Raised when the State of the FTP client changes.
    Syntax
    'Declaration
     
    
    Public Event StateChanged As EventHandler
    'Usage
     
    
    Dim instance As FtpClient
    Dim handler As EventHandler
     
    AddHandler instance.StateChanged, handler
    public event EventHandler StateChanged
    Example
    The following example demonstrates how to use the StateChanged event to display the state of the FTP client.This example assumes that you are in a Windows application and that the form contains a label.
    Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" ' Set license key here to deploy 
    
    Dim ftp As New FtpClient()
    
    AddHandler ftp.StateChanged, AddressOf Me.state_changed
    
    ftp.Connect( "localhost" )
    ftp.Login()
    
    ftp.ReceiveMultipleFiles( "ClientFiles\*", "d:\", True, True )
    
    ftp.Disconnect()
    
    Private Sub state_changed( ByVal sender As Object, ByVal e As EventArgs )
    
      label1.Text = CType( sender, FtpClient ).State.ToString()
      label1.Refresh()
    End Sub
    Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" // Set license key here to deploy 
    
    FtpClient ftp = new FtpClient();
    
    ftp.StateChanged += new EventHandler( this.state_changed );
    
    ftp.Connect( "localhost" );
    ftp.Login();
    
    ftp.ReceiveMultipleFiles( @"ClientFiles\*", @"d:\", true, true );
    
    ftp.Disconnect();
    
    private void state_changed( object sender, EventArgs e )
    {
      label1.Text = ( ( FtpClient )sender ).State.ToString();
      label1.Refresh();
    }
    Example
    Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" ' Set license key here to deploy Dim ftp As New FtpClient() AddHandler ftp.StateChanged, AddressOf Me.state_changed ftp.Connect( "localhost" ) ftp.Login() ftp.ReceiveMultipleFiles( "ClientFiles\*", "d:\", True, True ) ftp.Disconnect() Private Sub state_changed( ByVal sender As Object, ByVal e As EventArgs ) label1.Text = CType( sender, FtpClient ).State.ToString() label1.Refresh() End Sub
    Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" // Set license key here to deploy FtpClient ftp = new FtpClient(); ftp.StateChanged += new EventHandler( this.state_changed ); ftp.Connect( "localhost" ); ftp.Login(); ftp.ReceiveMultipleFiles( @"ClientFiles\*", @"d:\", true, true ); ftp.Disconnect(); private void state_changed( object sender, EventArgs e ) { label1.Text = ( ( FtpClient )sender ).State.ToString(); label1.Refresh(); }
    Supported Frameworks

    .NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.

    .NET Standard: netstandard2.0, netstandard2.1

    .NET Framework: net20, net35, net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.

    See Also