You are here: MessengerYouLike.IMSDK > IMSDK Reference > IMSDK Namespace > Classes > IMClient Class > IMClient Methods > IMClient.BeginRemoveFriend Method
MessengerYouLike
IMClient.BeginRemoveFriend Method

This Method Allows Users to Remove the Contact

C#
public BeginRemoveFriend(String Username, String Message);
Visual Basic
Public Sub BeginRemoveFriend(ByVal Username As String, Optional ByVal Message As String = "")
Parameters 
Description 
ByVal Username As String 
Username of the Contact that needs to be removed  
Optional ByVal Message As String = "" 
Message for the Contact 

This sub allows to remove the contact from the list and message can specified which will be available to Contact from which this contact is deleted next time the user logs in and if the user is online then message will be displayed live 

when the FriendRemoved is completed then the event IMSDK.IMClient.OnFriendRemovedCompleted is fired and if the Contact is online then the event is raised IMSDK.IMClient.OnOnlineFriendRemoved 

 

if the Contact being removed is offline then next time that contact Logs in then the event IMSDK.IMClient.OnFriendRemoved is fired

[Visual Basic]
 
'Create a new IMClient
Dim MC as new IMSDK.IMClient
 
 
 
'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)
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
 
 
 
 
'Remove a Contact
MC.BeginRemoveFriend(TxtFriendusername.text, TxtMessage.text)
 
 
 
 
'When  Contact is removed then this event is fired
 Private Sub MC_OnFriendRemovedCompleted(ByVal FriendUsername As String) Handles MC.OnFriendRemovedCompleted
     Debug.WriteLine("Friend : " & FriendUsername & " Removed")
 End Sub
 
Copyright (c) 2007. All rights reserved.