How can I put a newline into a TextBox, which only occurs when the string "CRLF" is received
This is what I am trying to achieve.
This is my textbox output at the moment
The line which shows CRLF?J] should be just a blank line.
This is the code I am using.
private void WriteData(string text)
{
if (text == "CRLF")
{
serial.DiscardInBuffer(); // clear "CRLF" from serial port buffer
serial.BaseStream.Flush();
OutputTextBox.AppendText("\n\n");
}
else
{
OutputTextBox.ScrollToEnd();
OutputTextBox.AppendText(text);
serial.BaseStream.Flush();
OutputTextBox.AppendText("\n");
}
}
Any and all help gratefully received.
This is my new code, works fine now, thanks all for contributing @Selvin pointed out the right path with his comment.
private void WriteData(string text)
{
string SerialData = text;
if (SerialData.Contains ("CRLF"))
{
serial.DiscardInBuffer(); // clear "CRLF" from serial port buffer
OutputTextBox.AppendText("\n");
}
else
{
OutputTextBox.ScrollToEnd();
OutputTextBox.AppendText(text + "\n");
}
}