Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Send SMS via Windows application
    text
    copied!<p>I want to send SMS by windows application. I ran the code but I got an error. This is</p> <pre><code>AT OK AT+CMGF=1 OK AT+CSCA="+9460921985" OK AT+CMGS="+9660775564" this is new message +CMS ERROR: 500 </code></pre> <p>I am using this code.</p> <pre><code>Public Class Form2 Dim number As String = "+9660775564" ''# Dim message As String = TextBox1.Text Dim serialport As New IO.Ports.SerialPort Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try With serialport .PortName = "COM5" ''# "COM24" .BaudRate = "9600" .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.RequestToSend .DtrEnable = True .RtsEnable = True End With serialport.Open() ''# checks phone status serialport.WriteLine("AT" &amp; vbCrLf) ''# Configures message as SMS serialport.WriteLine("AT+CMGF=1" &amp; vbCrLf) ''# Sets message center number ''# serialport.WriteLine("AT+CSCA=""+447785016005""" &amp; vbCrLf) serialport.WriteLine("AT+CSCA=""+9460921985""" &amp; vbCrLf) ''# Sets destination number serialport.WriteLine("AT+CMGS=""" &amp; number &amp; """" &amp; vbCrLf) ''# Specifies message and sends Ctrl+z serialport.WriteLine(TextBox1.Text &amp; Chr(26)) ''# Displays buffer containing output messages System.Threading.Thread.Sleep(2000) ''# CurrentThread.Sleep(2000) MsgBox(serialport.ReadExisting) serialport.Close() MessageBox.Show("OK") Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub </code></pre> <p>Thanks in advance for your help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload