locked
read data from serial port RRS feed

  • Question

  • hi

    how  to read contact names in phone and sms messages and view them in DataGridview via Serial Port?

    I deal with the Serialport and actually sent messages to the mobile phone, but I did not find information on how to withdraw the names and messages from the phone.

    Monday, November 23, 2020 8:13 AM

All replies

  • Hi ahmeddc,

    Thank you for posting here.

    Generally, we can use the following code to read data from serial port.

        Private port As SerialPort = New SerialPort("COM1", 9600, Parity.None, 8, StopBits.One)
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            AddHandler port.DataReceived, AddressOf post_DataReceived
            port.Open()
        End Sub
        Private Sub post_DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs)
            Dim str As String = port.ReadExisting()
            '...
        End Sub

    Besides, here's a reference you may need.

    receiving SMS using AT COMMANDS

    Hope it could be helpful.

    Best Regards,

    Xingyu Zhao


    Visual Basic and CLR forum will be migrating to a new home on Microsoft Q&A! (VB.NET and CLR) We invite you to post new questions in the new home on Microsoft Q&A ! For more information, please refer to the sticky post(VB.NET and CLR).

    Tuesday, November 24, 2020 2:59 AM