You are here: MessengerYouLike.IMSDK > Tutorials > Contacts Management > Delete Contact
MessengerYouLike
Delete Contact

How to Delete a Contact

  1. Complete Login User

 

 

  1. Now Call the Asynchronous Method IMSDK.IMClient.BeginRemoveFriend

 

[Visual Basic]
Private Sub DeleteAContactToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteAContactToolStripMenuItem.Click
        Try

            Dim fr As MessengerYouLike.IMSDK.Friends.MFriend = IMC.FindContactListFriend(tvwfriends.SelectedNode.Tag.ToString)
            If Not fr Is Nothing Then

                Dim rf As New IMSDK_DEMO.FrmRemoveFriend
                rf.lblremovefri.Text = "Are you sure you want to remove " & fr.FriendUsername
                rf.ShowDialog()

                If rf.DialogResult = Windows.Forms.DialogResult.OK Then
                    IMC.BeginRemoveFriend(fr.FriendUsername, rf.txtMessage.Text)
                End If

            Else

                Debug.WriteLine("select a friend to delete")

            End If

        Catch ex As Exception

        End Try
    End Sub

 

 

 

  1. When Friend Remove is complete then event IMSDK.IMClient.OnFriendRemovedCompleted is fired

 

[Visual Basic]
Private Sub IMC_OnFriendRemovedCompleted(ByVal FriendUsername As String) Handles IMC.OnFriendRemovedCompleted
        Debug.WriteLine("BeginRemoveFriend completed")
End Sub

 

 

 

 

  1. The friend which is removed is notified of this action via the event IMSDK.IMClient.OnFriendRemoved

 

[Visual Basic]
Private Sub IMC_OnFriendRemoved(ByVal FriendUsername As String, ByVal Message As String) Handles IMC.OnFriendRemoved
       Debug.WriteLine("You have been removed from " & FriendUsername & " Contacts List with a message " & vbCrLf & Message)
End Sub

 

 

 

 

  1. If the Friend Being removed is online then event IMSDK.IMClient.OnOnlineFriendRemoved is fired

 

[Visual Basic]
Private Sub IMC_OnOnlineFriendRemoved(ByVal FriendUsername As String, ByVal Message As String) Handles IMC.OnOnlineFriendRemoved
        ShowDlg("You have been removed from " & FriendUsername & " Contacts List who is online with a message " & vbCrLf & Message)
End Sub
You are here: MessengerYouLike.IMSDK > Tutorials > Contacts Management > Delete Contact
Copyright (c) 2007. All rights reserved.