mCore™ .NET SMS Library 1.2

mCore.SMSSendException Class

Description:

The mCore.SMSSendException is thrown for all errors related to sending of SMS using mCore.SMS.SendSMS method.

Namespace: mCore
Assembly: mCoreLib (in mCoreLib.dll)
Inherits: System.Exception

Usage Example:

Visual Basic

Public Class MyClass
   Public WithEvents objSMS As New mCore.SMS
   Public Sub SendMessage()

      Dim strMsg As String
      strMsg = "This is a very long text message and it has more than one _
               hundred sixty characters in it. This is to test how the _
               long message will be sent using mCore .NET SMS Library."
      Try
         SetCommParameters()
         objSMS.Encoding = mCore.SMS.EnumEncoding.GSM_Default_7Bit
         objSMS.LongMessage = mCore.SMS.EnumLongMessage.Concatenate
         Try
            objSMS.SendSMS("+919873094767", strMsg)
            MsgBox("Message Sent!")
         Catch ex As mCore.SMSSendException
            MsgBox("Message Failed!" & vbCrLf & ex.Message)
         End Try

      Catch ex As mCore.GeneralException
         MsgBox(ex.Message, MsgBoxStyle.Critical, "mCore Demo")
      Catch ex As Exception
      End Try
   End Sub

   Public Sub SetCommParameters()
      Try
         objSMS.Port = "COM1"
         objSMS.BaudRate = mCore.SMS.EnumBaudRate.BaudRate_19200
         objSMS.DataBits = mCore.SMS.EnumDataBits.Eight
         objSMS.StopBits = mCore.SMS.EnumStopBits.One
         objSMS.Parity = mCore.SMS.EnumParity.None
         objSMS.FlowControl = mCore.SMS.EnumFlowControl.RTS_CTS

      Catch ex As mCore.GeneralException
         MsgBox(ex.Message)
      Catch ex As Exception
      End Try
   End Function
End Class

 
C#

class MyClass
{
   public mCore.SMS objSMS = new mCore.SMS();
   public static void SendMessage()
   {
      string strMsg = "This is a very long text message and";
      strMsg = strMsg + " it has more than one hundred sixty";
      strMsg = strMsg + " characters in it. This is to test how";
      strMsg = strMsg + " the long message will be sent using";
      strMsg = strMsg + " mCore .NET SMS Library.";
      try
      {

         SetCommParameters();
         objSMS.Encoding = mCore.SMS.EnumEncoding.GSM_Default_7Bit;
         objSMS.LongMessage = mCore.SMS.EnumLongMessage.Concatenate;
         try
         {
            objSMS.SendSMS("+919873094767", "This is a test message");
            MessageBox.Show("Message Sent!");
         }
         catch (mCore.SMSSendException e)
         {
            MessageBox.Show("Message Failed!" + "\r\n" + e.ToString());
         }
      }

      catch (mCore.GeneralException e)
      {
         MessageBox.Show(e.ToString());
      }
      catch (Exception e)
      {
      }
   }

   public static void SetCommParameters()
   {
      try
      {
         objSMS.Port = "COM1";
         objSMS.BaudRate = mCore.SMS.EnumBaudRate.BaudRate_19200;
         objSMS.DataBits = mCore.SMS.EnumDataBits.Eight;
         objSMS.StopBits = mCore.SMS.EnumStopBits.One;
         objSMS.Parity = mCore.SMS.EnumParity.None;
         objSMS.FlowControl = mCore.SMS.EnumFlowControl.RTS_CTS;
      }

      catch (mCore.GeneralException e)
      {
         MessageBox.Show(e.ToString());
      }
      catch (Exception e)
      {
      }
   }
}

See Also:

mCore.GeneralException Class
mCore.SMSDeleteException Class
mCore.SMSReadException Class
mCore.vCalendarException Class
mCore.vCardException Class
mCore.WapPushException Class

 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved