Search code examples
c#.netserial-portportlpt

C# LPT Name problem


How can I send output to LPT in C#. I use SerialPort class. I set port name to "LPT1" and I'm getting this error.

The given port name does not start with COM/com or does not resolve to a valid serial port. Parameter name: portName

What to do?


Solution

  • You can't use SerialPort to access a Parallel Port. This will require P/Invoke to inpout32.dll to access. For details, see this tutorial.