Xceed .NET Libraries Documentation
CommandSent Event
Example 


Xceed.Ftp Assembly > Xceed.Ftp Namespace > FtpClient Class : CommandSent Event
Raised once for every command sent to the FTP server.
Syntax
'Declaration
 
Public Event CommandSent As CommandSentEventHandler
'Usage
 
Dim instance As FtpClient
Dim handler As CommandSentEventHandler
 
AddHandler instance.CommandSent, handler
public event CommandSentEventHandler CommandSent
Event Data

The event handler receives an argument of type CommandSentEventArgs containing data related to this event. The following CommandSentEventArgs properties provide information specific to this event.

PropertyDescription
Gets the command that was sent to the FTP server.  
Remarks

To be notified when a reply is received from the FTP server, subscribe to the ReplyReceived event.

This event is the equivalent of the LoggingCommandLine event of the ActiveX version of the Xceed FTP Library.

Example
The following example demonstrates how to use the CommandSent event to display logging information. Normally, the replies that are received from the FTP server would also be displayed via the ReplyReceived event. This example assumes that you are in a Windows application and that the form contains a listbox.
Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" ' Set license key here to deploy 


Dim ftp As New FtpClient()

AddHandler ftp.CommandSent, AddressOf Me.command_sent

ftp.Connect( "localhost" )
ftp.Login()

ftp.GetFolderContents()

ftp.Disconnect()

Private Sub command_sent( ByVal sender As Object, ByVal e As CommandSentEventArgs )

  listBox1.Items.Add( ">> " + e.Command )
  listBox1.SelectedItem = listBox1.Items.Count - 1
End Sub
Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" // Set license key here to deploy 

FtpClient ftp = new FtpClient();

ftp.CommandSent += new CommandSentEventHandler( this.command_sent );

ftp.Connect( "localhost" );
ftp.Login();

ftp.GetFolderContents();

ftp.Disconnect();

private void command_sent( object sender, CommandSentEventArgs e )
{
  listBox1.Items.Add( ">> " + e.Command );
  listBox1.SelectedItem = listBox1.Items.Count - 1;
}
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