harry_hitechpoi 0 Newbie Poster

hi,
i want to send and recieve sms using gsm modem that is connected to my pc with serial port.i already build a application in vb.net but i am facing a problem with reading and deleting message.
i do that with following code-

Dim comSerial As New System.IO.Ports.SerialPort
Dim strPhone_Number As String = ""
Dim strMessage1 As String = ""
Dim atcCommand As String
With comSerial
.PortName = "COM1"
.BaudRate = "9600"
.StopBits = IO.Ports.StopBits.One
.DataBits = 8
.Parity = IO.Ports.Parity.None
.ReadBufferSize = 10000
.ReadTimeout = 1000
.WriteBufferSize = 10000
.WriteTimeout = 10000
.RtsEnable = True
.Open()
.DiscardOutBuffer()
Dim i As Integer = 0
For i = 1 To 10

atcCommand = "AT+CMGR=" & i 'to read from inbox"
.Write(atcCommand + vbCrLf) 'execute command on buffer

Label1.Text = .ReadExisting()
atcCommand = "AT+CMGD=1" 'to delete from inbox
.Write(atcCommand + vbCrLf) 'execute command on buffer
'.Close()
Next
.Close()
End With
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
any body have idea bout that

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.