Console app serial read problem

Dear Forum members

I have written a console app to send and receive serial data.
The reason for a console app is because I want to run it as a Daemon backround program.

The sending of data works fine.
When I receive data it currently just writes the data to the console, but I would like to write the received data to a global string so that I can access it from the App run event to process the data.

Please find below a snapshot of the program that shows my current code in the receive event.


Please advise how to access the received data from the App Run event.

Kind regards

What’s inside your App.Run event?
did you create a mainloop calling App.DoEvents ?

Create a property in the App class and in CustomSerialConnection do something like:
App.WhatEverMyPropertyIsCalled = App.WhatEverMyPropertyIsCalled + Me.ReadAll(Encodings.ASCII)

NOTE. Depending on what you need to do with the data afterwards, it might be better to structure your processing code so that it isn’t in App.Run.

Hi there. Thank you for your quick response. I came right, thank you very much.

I did not know how to create a global property to share between the “App” and the “CustomSerialConnection” but I figured it out thanks.