title: Barcode Scanner - Serial Port
body: <p>So, I'm trying to use my Barcode Scanner as a 'Serial' device as opposed to a Keyboard emulator but it is not creating the com port. I have scanned the set-up codes from the manual that set it as a Serial device, that seems to configure the scanner correctly (it stops sending scanned codes to text-box\text editor) but because there is no COM port, I cannot capture the data when I scan a barcode......</p>
  
  <p>Windows installed the driver when it was first plugged in, there wasn't a disk\driver supplied... wondered if anyone else has experienced the same issue.....</p>
  
  <p>Here is my code....</p>
  
  <pre><code>class Program
  {
      // Create the serial port with basic settings
      private SerialPort port = new SerialPort("com1", 9600, Parity.None, 8, StopBits.One);
  
      [STAThread]
      static void Main(string[] args)
      {
          new Program();
      }
  
      private Program()
      {
  
          string[] ports = System.IO.Ports.SerialPort.GetPortNames();
  
          Console.WriteLine("Incoming Data:");
  
          // Attach a method to be called when there
          // is data waiting in the port's buffer
          port.DataReceived += new
            SerialDataReceivedEventHandler(port_DataReceived);
  
          // Begin communications
          port.Open();
  
          // Enter an application loop to keep this thread alive
          Application.Run();
      }
  
      private void port_DataReceived(object sender,
        SerialDataReceivedEventArgs e)
      {
          // Show all the incoming data in the port's buffer
          Console.WriteLine(port.ReadExisting());
      }
  }
  </code></pre>
  
  <p>I get the error message..... 'The port 'com1' does not exist'..... when I try to open the Port. </p>
  
  <p>When I create a virtual Port (using 3rd party app) the code runs BUT I still don't get the data from the Scanner....</p>