IsError Method

Description:

The IsError method returns true if there was any error during the last method call or property read/write (i.e. if ErrorCode returned a non-zero value). The IsError method also has optional parameters that allow you to specify if a error message box should be displayed and the title of the message box.

   

Usage blnResult = ObjectName.IsError([ShowMsgBox, [MsgBoxTitle]])
Parameters
  • ShowMsgBox As Boolean (Optional) - Whether a error message box should be displayed (Default: False)
  • MsgBoxTitle As String (Optional) - The title of the error message box (Default: "mCore")
Returns Boolean value
  • True - If there was a error during the last property read/write or method call
  • False - If there was no error during the last property read/write or method call
Remarks To display error message box for all errors use the property DebugMode

Usage Example:

Visual Basic / ASP (VBScript)
Dim objSMS As mCore.SMS
Set objSMS = New mCore.SMS
' You can also use Set objSMS = CreateObject("mCore.SMS")
' In case of ASP (VBScript) to create object use
' Set objSMS = Server.CreateObject("mCore.SMS")
' In ASP use Response.Write instead of MsgBox
objSMS.Port = "COM3"
objSMS.BaudRate = 19200
objSMS.Parity = "N"
objSMS.DataBits = 8
objSMS.StopBits = "1"
' It is not necessary to execute the 'Connect' method.
' Connection state is detected internally by mCore and
' the 'Connect' method is executed accordingly.
objSMS.PIN = "1234"
objSMS.MessageMemory = "ME"
If Not objSMS.IsError(True, "My Application") Then
     objSMS.Inbox.Refresh
End If
If objSMS.Inbox.Count > 0 Then
     MsgBox "Total " & objSMS.Inbox.Count & " messages."
     For i = 1 To objSMS.Inbox.Count
          MsgBox "From: " & objSMS.Inbox.Message(i).Phone & _
           VbCrLf & "Message: " & objSMS.Inbox.Message(i).Text
     Next
End If
' Disconnect method is executed internally
' whenever the SMS object is terminated.
Set objSMS = Nothing

  

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved