0
Hello
I am developing a software in C# that receives data via serial communication, everything is working but I have a little problem. My software receives the data via serial and displays in Text Box, but soon after the data is deleted from Text Box, I believe it is due to the Timer that I entered in the Software to check if something was received by Serial. I would like to receive the data and that they remain in Text Box, how to fix this problem ?
This is the part of the code that receives and displays the data:
private void timerReceive_Tick(object sender, EventArgs e)
{
if (serialPort1.IsOpen == true)
{
if (serialPort1.ReadBufferSize >= 0)
{
RxString = serialPort1.ReadExisting();
textBoxReceber.Text = RxString;
}
}
}
Thank you
As you are checking that the value is equal to 0 (zero) then it accepts and overwrites the value of the field. leave only when it is greater than 0.
if (serialPort1.ReadBufferSize >= 0)
– Mauro Rocha
Store content in a larger scope and concatenate
– Leandro Angelo