Option Strict On Imports System.IO.Ports Dim q As Queue(Of Byte) = New Queue(Of Byte) Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs) _ Handles SerialPort1.DataReceived While SerialPort1.BytesToRead > 0 q.Enqueue(CByte(SerialPort1.ReadByte)) End While End Sub Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick SyncLock q While q.Count > 0 Dim B As Byte = q.Dequeue tbRx.Text &= Hex(B) & " " End While End SyncLock End Sub Private Sub btnStop_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnStop.Click SerialPort1.Close() Timer1.Stop() End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)