c# serial port modal form on top stops receiving.

Im using VS 2005 C# WinCE6, I am using the serial port component to take in data.

It seems that when another modal form goes on top of the first the serial port stops receiving data and then when the modal form goes the port either stops working or suddenly all the data appears.

The worst is when it stops receiving data. The received event stops firing.

What is a way around this ? An example would be good.

Do I run the serial port in another thread or stop it when the modal windows is shown.
Who is Participating?
Jaime OlivaresSoftware ArchitectCommented:
You definitively need to put the listener function in a separated thread, because if you stay to much in the modal window, a timeout will occur.
Be aware that you may need to use a cross-thread UI technique to avoid an exception when updating your UI from the secondary thread.
if you use timer ?

if Yes:

use event on SerialPort1_DataReceived

if No:

Use Timer 100msec SerialPort1.ReadLine
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.