You are here: MessengerYouLike.IMSDK > Tutorials > Block Unblock Friend Management > Block Friend
MessengerYouLike
Block Friend

How To Block a Friend

  1. Complete Login User

 

 

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

 

[Visual Basic]
Private Sub BlockFriendToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BlockFriendToolStripMenuItem.Click
        With tvwfriends.SelectedNode
            Try
                Dim fr As MessengerYouLike.IMSDK.Friends.MFriend

                If (.Text.ToString) = "" Then
                    Exit Sub
                End If

                fr = IMC.FindContactListFriend(.Tag.ToString)
                If fr Is Nothing Then
                    Exit Sub
                End If

                IMC.BeginFriendBlockUnBlock(fr.FriendUsername, True)

            Catch ex As Exception

            End Try
        End With
    End Sub

 

 

 

 

  1. When Friend is Blocked the event IMSDK.IMClient.OnFriendBlocked is fired

 

[Visual Basic]
Private Sub IMC_OnFriendBlocked(ByVal FriendUsername As String) Handles IMC.OnFriendBlocked
        Debug.WriteLine("Friend " & FriendUsername & " Blocked")
    End Sub

 

 

 

 

  1. The friend being Block is notified of this action via the event IMSDK.IMClient.OnFriendAMIBlocked

 

[Visual Basic]
Private Sub IMC_OnFriendAMIBlocked(ByVal FriendUsername As String) Handles IMC.OnFriendAMIBlocked
        Debug.WriteLine("You have been blocked by :" & FriendUsername)
End Sub
You are here: MessengerYouLike.IMSDK > Tutorials > Block Unblock Friend Management > Block Friend
Copyright (c) 2007. All rights reserved.