I already have the working codes using USB broadband kit to send a message in VB to mobile phone. Now I am doing the other way which is getting the messages from the Broadband SIM here's the code:
Imports System
Imports System.IO.Ports
Public Class ReadSMS
Dim SerialPort As New System.IO.Ports.SerialPort()
Private Sub ReadNow_Click(sender As Object, e As EventArgs) Handles ReadNow.Click
If SerialPort.IsOpen Then
SerialPort.Close()
End If
SerialPort.PortName = "COM4"
SerialPort.BaudRate = 9600
SerialPort.Parity = Parity.None
SerialPort.StopBits = StopBits.One
SerialPort.DataBits = 8
SerialPort.Handshake = Handshake.None
SerialPort.DtrEnable = True
SerialPort.RtsEnable = True
SerialPort.NewLine = vbCrLf
SerialPort.ReadTimeout = 10000
SerialPort.Open()
If SerialPort.IsOpen() Then
Try
Debug.Print("START")
Debug.Print(SerialPort.ReadExisting)
Debug.Print("END")
Catch ex As Exception
MsgBox("read " & ex.Message)
End Try
Else
MsgBox("Port not available")
End If
End Sub
End Class
The code above is not working. This line always return an empty value Debug.Print(SerialPort.ReadExisting)
even if the SIM card has unread messages. Will that be okay if you will suggest me the best thing to do? Thanks Thanks!