Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

VS 2008 Cross thread read pop message at rumt ime

$
0
0
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

Viewing all articles
Browse latest Browse all 42215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>