I want to read the data from SERIAL PORT in text format and want to write it to the notepad I have used the below code to get data but still not working Anyone has any Idea For the same Please Update your help will be appreciated.
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
ReceiveSerialData()
End Sub
Function ReceiveSerialData() As String
' Receive strings from a serial port.
Dim returnStr As String = ""
Dim com1 As IO.Ports.SerialPort = Nothing
Try
com1 = My.Computer.Ports.OpenSerialPort("COM3")
com1.ReadTimeout = 10000
Do
Dim Incoming As String = com1.ReadLine()
If Incoming Is Nothing Then
Exit Do
Else
returnStr &= Incoming & vbCrLf
End If
Loop
Catch ex As TimeoutException
returnStr = "Error: Serial Port read timed out."
Finally
If com1 IsNot Nothing Then com1.Close()
End Try
Return returnStr
MsgBox(returnStr)
End Function