'Declaration Public Event MultipleFileTransferError As MultipleFileTransferErrorEventHandler
'Usage Dim instance As FtpClient Dim handler As MultipleFileTransferErrorEventHandler AddHandler instance.MultipleFileTransferError, handler
public event MultipleFileTransferErrorEventHandler MultipleFileTransferError
Event Data
The event handler receives an argument of type MultipleFileTransferErrorEventArgs containing data related to this event. The following MultipleFileTransferErrorEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Action | Gets or sets a value indicating the action to take for the file failed to be transferred during a multiple-file transfer. |
Exception | Gets the exception that was thrown while attempting to transfer a file during a multiple-file transfer. |
LocalItemName | Gets the local path and name of the item that failed to be transferred during a multiple-file transfer. |
RemoteItemName | Gets the remote name of the item that failed to be transferred during a multiple-file transfer. |
RemoteItemType | Gets or sets the type of the remote item which failed to be transferred during a multiple-file transfer. |
Remarks
This event can only be raised by the SendMultipleFiles or ReceiveMultipleFiles methods.
Example
The following example demonstrates how to use the MultipleFileTransferError event to continue downloading during the multiple-file transfer even when one of the files causes an error. 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.MultipleFileTransferError, AddressOf Me.transfer_error ftp.Connect( "localhost" ) ftp.Login() ftp.ChangeCurrentFolder( "ClientFiles" ) ftp.ReceiveMultipleFiles( String.Empty, "C:\ClientFiles", False, False ) ftp.Disconnect() Private Sub transfer_error( ByVal sender As Object, ByVal e As MultipleFileTransferErrorEventArgs ) If TypeOf e.Exception Is FtpReplyException Then ListBox1.Items.Add("Unable to transfer " + e.RemoteItemName + _ ". The message returned by the FTP server was : " + e.Exception.Message) e.Action = MultipleFileTransferErrorAction.Ignore End If End Sub
Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" // Set license key here to deploy FtpClient ftp = new FtpClient(); ftp.MultipleFileTransferError += new MultipleFileTransferErrorEventHandler( this.transfer_error ); ftp.Connect( "localhost" ); ftp.Login(); ftp.ChangeCurrentFolder( "ClientFiles" ); ftp.ReceiveMultipleFiles( string.Empty, @"C:\ClientFiles", false, false ); ftp.Disconnect(); private void transfer_error( object sender, MultipleFileTransferErrorEventArgs e ) { FtpReplyException exception = e.Exception as FtpReplyException; if( exception != null ) { listBox1.Items.Add( "Unable to transfer " + e.RemoteItemName + ". The message returned by the FTP server was : " + e.Exception.Message ); e.Action = MultipleFileTransferErrorAction.Ignore; } }
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