I get an I/O exception when I run serialport.close() "The I/O operation has been aborted because of either a thread exit or an application request". The exception comes from the datareceived event. I don't want this exception, can anyone tell me how to get rid of it. I have tried Removehandler and sleep before calling close(), but nothing seems to help. In my datareceived procedure I have;
if SerialPort1.IsOpen then
Try
readBuffer = SerialPort1.ReadLine()
Me.BeginInvoke(New EventHandler(Addressof DoUpDate))
Catch Ex as Exception
MsgBox(ex.message)
End Try
End If
I am sure that the exception comes from the ReadLine() statement when I try to close the serialport with serialport1.close. Thank you in advance for your help.