You are here: MessengerYouLike.IMSDK > IMSDK Reference > IMSDK Namespace > Classes > FileTransfer Class > FileTransfer Methods > FileTransfer.CancelFileTransfer Method
MessengerYouLike
FileTransfer.CancelFileTransfer Method

This Method Allows Users to cancel the file transfer which is in progress

C#
public Boolean CancelFileTransfer(String FileTransferID);
Visual Basic
Public Function CancelFileTransfer(ByVal FileTransferID As String) As Boolean
Parameters 
Description 
ByVal FileTransferID As String 
ID of File Transfer 

Any File Transfer in progress either on sending IMClient or Receiving IMClient can be canceled via this method

[Visual Basic]
 
'Create a new IMClient
Dim MC as new IMSDK.IMClient
 
 
 
'Create a new MCUser
 Public MCUser As New IMSDK.User
 
 
 
'Call the Listen Sub
MC.Listen()
 
 
 
'Now Try to login
MC.BeginLogin(TxtUsername.Text,TxtPassword.Text)
 
 
 
 
'if username and password is valid then
Private Sub MC_OnLoggedin(ByVal UserObject As IMSDK.User) Handles MC.OnLoggedin
    Debug.WriteLine("Username logged in : " & MCUser.Username & " , " & MCUser.Password)
 
        MCUser = New IMSDK.User
        MCUser = UserObject
        Msgbox("Username is " & MCUser.Username)
 
End Sub
 
 
 
 
'if username or password is invalid then
Private Sub MC_OnUsernameOrPasswordInvalid(ByVal Username As String, ByVal Password As String) Handles MC.OnUsernameOrPasswordInvalid
  Debug.WriteLine("Username password invalid : " & Username & " , " & Password)
End Sub
 
 
 
 
 
    Friend Sub CancelFileTransfer(ByVal FileTransferID As String)
 
        For i As Integer = 0 To MCUser.FileTransfers.GetCount - 1
            Try
                If MCUser.FileTransfers.Item(i).FileTransferID = FileTransferID Then
                    MCUser.FileTransfers(i).CancelFileTransfer(FileTransferID)
                End If
            Catch ex As Exception
                Debug.WriteLine(ex.ToString)
            End Try
 
        Next
 
 
    End Sub
 
 

 

Copyright (c) 2007. All rights reserved.