title: port.ReadExisting(): Input string was not in a correct format
body: <p>I am building a c# application that gets information from an Arduino (button presses) and then navigates to the corresponding website in a web browser. I have 3 buttons which are respectively printing 1, 2 and 3 to the serial monitor.</p>
  
  <p>Following that, when a software button is pressed, the c# app reads the number that has been sent by the arduino using port(ReadExisting()) with port being the name of my serial port.</p>
  
  <p>It works well when I press an Arduino button, my application reads the number and performs the correct action. However, I tried printing a number to the serial monitor when no button is pressed (I tried both 0 and 4) but it doesn't seem to work. The serial monitor on Arduino does show the number appearing when none of the buttons is pressed, but my c# crashes when attempting to read it.</p>
  
  <p>The error message I get when it crashes is "input string was not in a correct format"</p>
  
  <p>The relevant bit of the c# code (the text is in Dutch but it is not important): </p>
  
  <pre><code> private void updateBtn_Click(object sender, EventArgs e)
          {
              message = Convert.ToInt32(port.ReadExisting());
              btnLab.Text = Convert.ToString(message);
  
              if (message == 1)
              {
                  MessageBox.Show("Er is drugsafval gedropt in Breda! Klik op alarm voor de locatie en op route voor de weg ernaartoe.");
                  logBox.Items.Add("Merodelaan Breda," + DateTime.Now);
              } else if (message == 2)
              {
                  MessageBox.Show("Er is drugsafval gedropt in Tilburg! Klik op alarm voor de locatie en op route voor de weg ernaartoe.");
                  logBox.Items.Add("Leijweg Tilburg," + DateTime.Now);
              } else if (message == 3)
              {
                  MessageBox.Show("Er is drugsafval gedropt in Breda! Klik op alarm voor de locatie en op route voor de weg ernaartoe.");
                  logBox.Items.Add("Bergsche Hoevenpad Oss," + DateTime.Now);
              } 
          } else if (message == 0)
          {
                  MessageBox.Show("Er is momenteel geen alarm.");
  
  }
  </code></pre>
  
  <p>Relevant corresponding Arduino code (for one of the buttons, for each next button it is completely the same):</p>
  
  <pre><code>void loop() {
    String input = Serial.readStringUntil('\n');
    bredaState = digitalRead(bredaBtn);
    tilburgState = digitalRead(tilburgBtn);
    ossState = digitalRead(ossBtn);
  
    if (bredaState == LOW)
    {
      digitalWrite(bredaLed, LOW);
      Serial.println("0");
    }
    else {
      Serial.println("1");
      lcd.clear();
  
      lcd.print("Alarm:Drugsafval");
      lcd.setCursor(0,1);
      lcd.print("in Breda!");
      bredaState = digitalRead(bredaBtn);
      for(int i=0; i&lt;4; i++){
      digitalWrite(bredaLed, HIGH);
      delay(200);
      digitalWrite(bredaLed, LOW);
      delay(200);
      digitalWrite(bredaLed, HIGH);
      }
  
      buzz();
      lcd.clear();
      lcd.print("Er is momenteel");
      lcd.setCursor(0, 1);
      lcd.print("geen alarm!");
    }
  </code></pre>