S
sklett
I'm trying to send some printer commands (ZPLII) to an attached USB printer
using the SerialPort component. I didn't get very far at all. In fact I
haven't gotten anywhere.
The first problem I encountered is that a call to SerialPort.GetPortNames()
returns an empty string[]. In other words, NO port names are returned. I'm
not terribly knowledgable about ports but from the Hardware Manager I did
notice that I don't have the Ports and Devices entry (I think that's what
it's called).
If I show the properties dialog for an installed printer and change to the
Ports tab I see several ports listed (LPT1, COM1, USB001, etc).
So my question is: Should SerialPort.GetPortNames() be returning the USB,
LPT1 and COM ports I see in the printer dialog? Am I expecting it to do
somethinh it shouldn't?
There very simple line of code:
string[] ports = System.IO.Ports.SerialPort.GetPortNames();
The port I want to open is called "USB001" - when I try to open that port
using the SerialPort component I get an exception that states the name must
start with "COM".
So my #2 question is: What is the method that you all use to communicate
with a USB attached device? If it's not the SerialPort component, is there
another component in the class library?
I thought this would be a piece of cake!
Thanks for any help,
Steve
using the SerialPort component. I didn't get very far at all. In fact I
haven't gotten anywhere.
The first problem I encountered is that a call to SerialPort.GetPortNames()
returns an empty string[]. In other words, NO port names are returned. I'm
not terribly knowledgable about ports but from the Hardware Manager I did
notice that I don't have the Ports and Devices entry (I think that's what
it's called).
If I show the properties dialog for an installed printer and change to the
Ports tab I see several ports listed (LPT1, COM1, USB001, etc).
So my question is: Should SerialPort.GetPortNames() be returning the USB,
LPT1 and COM ports I see in the printer dialog? Am I expecting it to do
somethinh it shouldn't?
There very simple line of code:
string[] ports = System.IO.Ports.SerialPort.GetPortNames();
The port I want to open is called "USB001" - when I try to open that port
using the SerialPort component I get an exception that states the name must
start with "COM".
So my #2 question is: What is the method that you all use to communicate
with a USB attached device? If it's not the SerialPort component, is there
another component in the class library?
I thought this would be a piece of cake!
Thanks for any help,
Steve