Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
'----------------------------------------------------------------------------------------------------------
'If SerialPort1.IsOpen Then
Try
If SerialPort1.BytesToRead >= 4 Then
SerialPort1.ReadTimeout = 1000
m_strInBuff = (SerialPort1.ReadTo(Chr(13)))
Show_Error("m_strInBuff = " & SerialPort1.ReadExisting)
End If
'data to UI thread
Me.Invoke(New EventHandler(AddressOf DoUpdate))
System.Threading.Thread.Sleep(20)
Catch ex As Exception
MsgBox("read " & ex.Message)
End Try
'End If
End Sub
Public Sub DoUpdate(ByVal sender As Object, ByVal e As System.EventArgs)
'SerialPort1.ReadTimeout = 1000
'm_strInBuff = SerialPort1.ReadExisting
Show_Error("m_strInBuff " & SerialPort1.ReadExisting)
Call HandleInput(m_strInBuff)
End Sub
'----------------------------------------------------------------------------------------------------------
'If SerialPort1.IsOpen Then
Try
If SerialPort1.BytesToRead >= 4 Then
SerialPort1.ReadTimeout = 1000
m_strInBuff = (SerialPort1.ReadTo(Chr(13)))
Show_Error("m_strInBuff = " & SerialPort1.ReadExisting)
End If
'data to UI thread
Me.Invoke(New EventHandler(AddressOf DoUpdate))
System.Threading.Thread.Sleep(20)
Catch ex As Exception
MsgBox("read " & ex.Message)
End Try
'End If
End Sub
Public Sub DoUpdate(ByVal sender As Object, ByVal e As System.EventArgs)
'SerialPort1.ReadTimeout = 1000
'm_strInBuff = SerialPort1.ReadExisting
Show_Error("m_strInBuff " & SerialPort1.ReadExisting)
Call HandleInput(m_strInBuff)
End Sub