OnProgress Event  
 

The OnProgress event is generated when retrieving or sending files.

Syntax

Private Sub object_OnProgress([Index As Integer,] ByVal FileName As Variant, ByVal FileSize As Variant, ByVal BytesCopied As Variant, ByVal Percent As Variant)

Remarks

The OnProgress event is generated during a file transfer and can be used to update the user interface, such as displaying a progress bar during the transaction. To cancel the current file transfer, the application can call the Cancel method within the event handler. The following arguments are passed to the event:

The FileName argument is the name of the file being transferred. If the GetMultipleFiles or PutMultipleFiles methods were used, each individual file name is returned instead of the wildcard mask.

The FileSize argument is a long integer which specifies the size of the file in bytes that is currently being sent or received. This value may be zero if the control cannot obtain the size of the file from the server. If the total number of bytes is less than 2 GiB, the value will be a Long (32-bit) integer. For very large transfers, it will be a Double floating-point value.

The BytesCopied argument is a long integer which specifies the number of bytes that have been sent or received for the current file transfer. If the number of bytes copied is less than 2 GiB, the value will be a Long (32-bit) integer. For very large transfers, it will be a Double floating-point value.

The Percent argument is an integer which specifies the completion percentage between a value of 0 and 100. When the GetMultipleFiles or PutMultipleFiles methods are being used, this value refers to the transfer status of a single file, not a percentage of the total number of files being transferred.

Example

Private Sub FileTransfer1_OnProgress(ByVal FileName As Variant, _
                                     ByVal FileSize As Variant, _
                                     ByVal BytesCopied As Variant, _
                                     ByVal Percent As Variant)

    txtFileStatus.Text = txtFileStatus.Text & _
        FileName & " " & FileSize & " " & _
        BytesCopied & " " & Percent & " " & _
        FileTransfer1.TransferTime & vbCrLf

    txtFileStatus.SelStart = Len(txtResultStream.Text)  
    txtFileStatus.SelLength = 0

    If FileSize > 0 Then
        ProgressBar1.Value = Percent
    End If
End Sub

See Also

Cancel Method