mCore™ .NET SMS Library 1.2

mCore.SMS.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).

Namespace: mCore
Assembly: mCoreLib (in mCoreLib.dll)

Overload List:

Name Description
IsError () Returns True if there was a error during last method call or last get/set of any property.
IsError (ShowMsgBox As Boolean) Returns True if there was a error during last method call or last get/set of any property and displays a MsgBox about the error.
IsError (ShowMsgBox As Boolean, MsgBoxTitle As String) Returns True if there was a error during last method call or last get/set of any property and displays a MsgBox about the error and allows you to specify the MsgBox title string.

Exceptions:

mCore.GeneralException

Usage Example:

Visual Basic
Public Class MyClass
   Public WithEvents objSMS As New mCore.SMS

   Public Sub ModemConnect()
      Dim strError As String

      Try
         objSMS.DebugMode = True
         objSMS.Port = "COM1"
         objSMS.BaudRate = mCore.BaudRate.BaudRate_19200
         objSMS.DataBits = mCore.DataBits.Eight
         objSMS.StopBits = mCore.StopBits.One
         objSMS.Parity = mCore.Parity.None
         objSMS.FlowControl = mCore.FlowControl.RTS_CTS
         objSMS.Connect()

      Catch ex As mCore.GeneralException

      Catch ex As Exception

      End Try

      If objSMS.IsError() Then

         strError = "ERROR " & objSMS.ErrorCode.ToString() & ": " & objSMS.ErrorDescription

         MsgBox(strError, MsgBoxStyle.Critical, "mCore Demo")
      End If

   End Function
End Class

 
C#
class MyClass
{
   public mCore.SMS objSMS = new mCore.SMS();
   public static void ModemConnect()
   {
      string strError = "";
      try
      {
         objSMS.DebugMode = true;
         objSMS.Port = "COM1";
         objSMS.BaudRate = mCore.BaudRate.BaudRate_19200;
         objSMS.DataBits = mCore.DataBits.Eight;
         objSMS.StopBits = mCore.StopBits.One;
         objSMS.Parity = mCore.Parity.None;
         objSMS.FlowControl = mCore.FlowControl.RTS_CTS;
         objSMS.Connect();
      }

      catch (mCore.GeneralException e)
      {
      }
      catch (Exception e)
      {
      }

      If (objSMS.IsError())
      {
         strError = "ERROR " + objSMS.ErrorCode.ToString() + ": " + objSMS.ErrorDescription;
         MessageBox.Show(strError);
      }
   }
}

See Also:

mCore.SMS.DebugMode Property

 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved