I am trying to transfer some data at 115200 Bd to a C# form RichTextBox. Below is my Arduino code:
void serialEvent() { 
  
  if (Serial.available()) {
    int command = Serial.parseInt();
    Serial.println(command);
    switch(command) {
    case 1:
      /*executes its job and writes data in the following format in each line - xxxxxx xxx xxx*/
      break;
    case 0:
      /*executes another unrelated job*/
      break;  
    }
  }
}
Now the total written lines stop printing to my C# form around the 6000/7000 line. Why is that, and how to rectify it? I can't reduce my baudrate; in fact, I would like to increase it. I would like to have the data accessible in a way that I can perform mathematical functions on it through the C# form and also copy it if I need to.
Below is my C# form application code part:
private void settext(string val)
    {
        richTextBox1.AppendText(val);
    }
    private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
    {
        string incomstring = serialPort1.ReadLine();
        settext(incomstring);
    }
private void button5_Click_1(object sender, EventArgs e)
    {
        try
        {
            Cursor.Current = Cursors.WaitCursor;
            if (serialPort1.IsOpen)
            {
                serialPort1.WriteLine("1");
            }
            else
            {
                MessageBox.Show("Open Port FIrst.", "Port not open.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
        finally
        {
            Cursor.Current = Cursors.Default;
        }
        
    }