How to Send SMS using
  • How to Send SMS using
  • 1 Comment sorted by

  • first make sure on which port your modem will connect then use this code

    Imports System.Threading
    Imports System.IO.Ports
    Public Class frmSendSMS
    Public Shared Commport As String
    Public Shared MSGNO As Integer

    pUBLIC Sub send()

    Dim Incoming, SubStr, Result As String
    Dim MessageNo, N As Integer

    Using comm As IO.Ports.SerialPort = My.Computer.Ports.OpenSerialPort(cboPortName.Text, 9600)
    comm.DtrEnable = True
    comm.Write("AT" & vbCrLf)
    Result = comm.ReadLine()
    comm.Write("AT+CMGF=1" & vbCrLf)
    Result = comm.ReadLine()
    comm.Write("AT+CMGW=" & Chr(34) & tbTo.Text & Chr(34) & vbCrLf)
    Result = comm.ReadLine()
    comm.Write(tbMessage.Text & Chr(26) & vbCrLf) ' Ctrl-Z Character
    Result = comm.ReadLine()
    Result = comm.ReadLine()
    ' Find the Message No. in Mobile Memory
    Incoming = comm.ReadExisting
    N = Incoming.IndexOf("+CMGW:")
    N = N + 6
    SubStr = Incoming.Substring(N)
    MessageNo = Val(SubStr)

    comm.WriteLine("AT+CMSS=" & MessageNo & vbCrLf)
    Result = comm.ReadLine()
    Result = comm.ReadLine()
    MSGNO = MessageNo

    End Using

    END sub

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week