SerialPort not receiving any data

前端 未结 3 971
一生所求
一生所求 2020-11-22 11:40

I am developing program which need to interact with COM ports.

By learning from this Q&A: .NET SerialPort DataReceived event not firing, I make my code like that

3条回答
  •  执念已碎
    2020-11-22 12:12

    I had a quite similar problem. In a graphical application (C# win form) I had a class which encapsulate a SerialPort component. The DataReceived event was firing only one time, but then any following data received didn't fire any event. I solved the problem by calling the Close method in my principal form Closed event function. No idea of why that changes anything, but now it's working.

提交回复
热议问题