Async-Await cant access to the serial port from another form?

  • Thread starter Thread starter Raffy_Raff
  • Start date Start date
R

Raffy_Raff

Guest
have stuck with async of the serial port and facing a really strange problem, I'm trying to send the file through the serial port asynchronously by 4096-byte chunks, the problem is that when I call -


Await Task.Run(Sub()

It gives me the exception of the serial port that serial port is closed, while it is opened. The funny thing if you do the same code in the main form, where serialport is located, the code works like a charm without any errors. But when I try to access the port from another form asynchronously it shows me an error about the port is closed. Is it any way to make it work?
I am just curious why my code works in the form where the serial port located and doesn't in another form. Thanks in further

Continue reading...
 
Back
Top