usb connection as com port using 2.0 SerialPort component

E

egress

Forgive me for stupid questions for I am new to serial IO programming.

I am developing an app that will need to communicate with a device via
RS232 protocol using a standard 9 pin serial cable. From what I
understand this can be accomplished relativly easy using .net 2.0
SerialPort component over a COM port.

My question: because most newer computers don't have 9 pin serial
ports (COM), can the SerialPort component use a USB connection just
the same as it would a serial port? If so, how would I accomplish
this using the SerialPort component? What other alternatives might
there be?

Thanks in advance for any info.
 
M

Miro

egress said:
Forgive me for stupid questions for I am new to serial IO programming.

I am developing an app that will need to communicate with a device via
RS232 protocol using a standard 9 pin serial cable. From what I
understand this can be accomplished relativly easy using .net 2.0
SerialPort component over a COM port.

My question: because most newer computers don't have 9 pin serial
ports (COM), can the SerialPort component use a USB connection just
the same as it would a serial port? If so, how would I accomplish
this using the SerialPort component? What other alternatives might
there be?

Thanks in advance for any info.

I have done something similar.
There is an adapter you can get that is a "serial" to USB adapter, and
this comes with an install disk.

Once that is installed, then when you plug in the unit ( in my case it
was a rf / barcode scanner ) then by going into control panel / system
settings, you would notice that it actually has assigned a com port to it.

This might help you out as well, it gets all the ports that are in use.

Dim CurrentAvailPorts As Array = SerialPort.GetPortNames()

Run it, plug in your usb, and run it again, and the difference is your
new com port.

I have found some strange things with the serialport component.
Some of its events dont fire when I would expect them to, but for the
most part my simple program did the trick. A few exceptions i cant seem
to catch every once in a while, but its a workin progress.

Miro
 
D

Dick Grier

Hi,

You would use a USB serial adapter. These range in price from $15 (up).
The device driver that is installed for the adapter creates a "virtual
serial port" that Windows applications use just like any physical
hardware -- all of the APIs are the same.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top