title: Problem reading Serial Port C#.net 2.0 to get Weighing machine output
body: <p>I'm trying to read weight from Sartorius Weighing Scale model No BS2202S using the following code in C#.net 2.0 on a Windows XP machine:  </p>
  
  <pre><code>public string readWeight()
  {
      string lastError = "";
      string weightData = "";
      SerialPort port = new SerialPort();
      port.PortName = "COM1";
      port.BaudRate = 9600;
      port.Parity = Parity.Even;
      port.DataBits = 7;
      port.StopBits = StopBits.One;
      port.Handshake = Handshake.RequestToSend;
      try {
          port.Open();
          weightData = port.ReadExisting();
          if(weightData == null || weightData.Length == 0) {
              lastError = "Unable to read weight. The data returned form weighing machine is empty or null.";
              return lastError;
          }
      }
      catch(TimeoutException) {
          lastError = "Operation timed out while reading weight";
          return lastError;
      }
      catch(Exception ex) {
          lastError = "The following exception occurred while reading data." + Environment.NewLine + ex.Message;
          return lastError;
      }
      finally {
          if(port.IsOpen == true) {
              port.Close();
              port.Dispose();
          }
      }
      return weightData;
  }
  </code></pre>
  
  <p>I'm able to read the weight using Hyperterminal application (supplied with Windows XP) with the same serial port parameters given above for opening the port. But from the above code snippet, I can open the port and each time it is returning empty data.<br>
  I tried opening port using the code given <a href="https://stackoverflow.com/questions/644954/reading-from-the-serial-port-in-c">this Stack Overflow thread</a>, still it returns empty data.<br>
  Kindly assist me.</p>