Hello,
I have a program that continuously reads in streaming serial port data and plots this data on a chart. I am getting an error and the program is crashing when I try to disconnect the serial port. I believe it is because there is still data in the receive buffer when I try to disconnect. I tried to use the following to disconnect my port, but it still gives the error in my receive sub routine. Is there another way to cleanly disconnect and close the serial port?
SerialPort1.DiscardInBuffer()SerialPort1.Close()
SerialPort1.Dispose()
Thank you.
I have a program that continuously reads in streaming serial port data and plots this data on a chart. I am getting an error and the program is crashing when I try to disconnect the serial port. I believe it is because there is still data in the receive buffer when I try to disconnect. I tried to use the following to disconnect my port, but it still gives the error in my receive sub routine. Is there another way to cleanly disconnect and close the serial port?
SerialPort1.DiscardInBuffer()SerialPort1.Close()
SerialPort1.Dispose()
Thank you.