Delete Method

Description:

The Delete method deletes the message (pointed by the message Index) from the Inbox as well as the Modem.

   

Usage
  • blnResult = ObjectName.Inbox.Message(Index).Delete
  • blnResult = ObjectName.Inbox(Index).Delete
Parameters Index - The Index of the message to be deleted
Returns Boolean value
  • True - If the message was deleted successfully
  • False - If there was a error in deleting the message
Remarks
  • Calling the Delete method for a particular message item, alters the Index of the message for all the message items located after that message.
  • To delete all the messages from the Inbox it is wise to start deleting from the message with the maximum Index value (the Count property) creating a loop till Index value 1.

Usage Example:

Visual Basic / ASP (VBScript)
Dim objSMS As mCore.SMS, i As Integer
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 = "COM2"
objSMS.BaudRate = 57600
objSMS.Parity = "N"
objSMS.DataBits = 8
objSMS.StopBits = "1"
objSMS.Inbox.Concatenate = True
objSMS.MessageMemory = "SM"
objSMS.Inbox.Refresh
If Not objSMS.IsError(True) And objSMS.Inbox.HasMessages Then
     MsgBox "Total " & objSMS.Inbox.Count & " incoming messages!"

     ' The following code deletes the 1st to 3rd message in Inbox
     For i = objSMS.Inbox.Count to 1 Step -1
          MsgBox objSMS.Inbox.Message(i).TimeStampRFC &  vbCrLf _
           & "From: " & objSMS.Inbox.Message(i).Phone & vbCrLf _
           & objSMS.Inbox.Message(i).Text
          If i <= 3 Then
               objSMS.Inbox.Message(i).Delete
          End If
     Next

     ' The next few lines of code deletes all the messages in
     ' the Inbox (Same result as Clear method of Inbox
     ' e.g. objSMS.Inbox.Clear)
     For i = objSMS.Inbox.Count To 1 Step -1
          objSMS.Inbox(i).Delete
     Next
     MsgBox "Total " & objSMS.Inbox.Count & " messages!"
End If
Set objSMS = Nothing

  

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved