You are here: MessengerYouLike.IMSDK > IMSDK Reference > IMSDK Namespace > Classes > IMClient Class > IMClient Events > IMClient.OnError Event
MessengerYouLike
IMClient.OnError Event

When an exception occurs in IMClient

C#
public event OnError;
Visual Basic
Public Event OnError(ByVal Exception As System.Exception, ByVal ErrorString As String)
Return Values 
Description 
ByVal Exception As System.Exception 
Exception occurred in IMClient 

This Event is fired when there is error in the IMClient ,mostly due to invalid data

[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
 
 
 
'Exception Occurred
Private Sub IMC_OnError(ByVal Exception As System.Exception) Handles IMC.OnError
        ShowDlg(Exception.ToString)
End Sub
Copyright (c) 2007. All rights reserved.