Question Problems with application locking up

sburks92131

New member
Joined
Aug 2, 2011
Messages
3
Location
San Diego, California, United States
Programming Experience
Beginner
Hi,
I have created an application with 3 terminal windows for capturing data from 3 serial ports and outputting the data to a file. It seems to work well with one serial port, but when I fire all 3 serial ports at once, the application hangs. Here is the portion of the code that I believe is the problem. The code below is for Serial Port A. I have the same code for Serial Port B and Serial Port C

Private Sub ASerialPort_OnComm() Handles ASerialPort.OnComm

ReceiveBufferA.Append(ASerialPort.InputString)
Me.BeginInvoke(New EventHandler(AddressOf ReceivedTextA))

End Sub

Private Sub ReceivedTextA(ByVal sender As Object, ByVal e As EventArgs)

rtbA.Text = ReceiveBufferA.ToString(0, ReceiveBufferA.Length)
rtbA.SelectionStart = rtbA.Text.Length
rtbA.ScrollToCaret()

End Sub

Private Sub btnAStopXfer_Click(sender As System.Object, e As System.EventArgs) Handles btnAStopXfer.Click

Try
If ASerialPort.PortOpen = True Then ASerialPort.PortOpen = False
btnAStartXfer.Enabled = True
btnAStopXfer.Enabled = False
Catch ex As Exception
MsgBox(ex.Message)
End Try

rtbA.SaveFile(Afile, RichTextBoxStreamType.PlainText)

rtbA.Clear()

ReceiveBufferA.Clear()

End Sub

I would appreciate any insight into the problem I am seeing.
 
You should try the SerialPort component included in .Net, find it in Toolbox.
 
Hi John,
I have tried using the serial port component in the .NET framework, but there is some issue between reading the buffer and the stream when using the DataReceived event. So, I have used the DesktopSerialIO.dll provided by Dick Grier. Do you know what the issue is with the DataReceived event in .NET?
 

Latest posts

Back
Top