Serial ports.

T

TClancey

Hi.

I have an app that is going to connect to several virtual com ports,
although the system will see them as 'real'.

How can I list the installed com ports on the system? I've found
System.Io.Ports.xxx but there isn't a count or enumerator?

Any ideas?

Cheers,
Tull.
 
D

Dick Grier

Hi,

The PortName method returns a String array of installed ports. You can
download example code from my homepage that illustrates this.

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.
 
T

TClancey

Not really, I'm using vb 2005 so there is a SerialPort control available. I
just need to know how to list the ports in teh system.

Thanks,
Tull.
 
T

TClancey

Thanks Dick, which download are you refering to? You have quite a few.

I've tried using GetPortNames.ToString all I get is System.String[]

Cheers,
Tull.
 
T

TClancey

Sorry I see what you mean now.

However if I try

Dim p() As String
p = IO.Ports.SerialPort.GetPortNames
MsgBox(UBound(p))
All I get is '0'
 
D

Dick Grier

Hi,

This is odd. I have no trouble with both actual physical ports AND virtual
serial ports. Does HyperTerminal "see" the VP? I assume that when you run
my example, you also do not see your ports?

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.
 
T

TClancey

I wasn't sure which example to download, can you please let me know and I'll
try it.

HT sees the com port without any problems. I can open the port in VB and
get data, I just can't get the list of ports back. Unless I'm doing
something completely wrong!
 

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