473,324 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

COM port information

I have a simple routine that can retreive a list of com ports on my machine.
I would also like to get additional information about the ports..such as the
Device Description (which is found in the system's device manager). For
example: COM1 = Communications Port or COM 6 = USB Serial Port

Thanks.

For i As Integer = 0 To My.Computer.Ports.SerialPortNames.Count - 1
boxOutput.Text &= My.Computer.Ports.SerialPortNames(i) & vbCrLf
Next

Oct 15 '08 #1
1 6983
Try WMI (System.Management). For example (from my book):

Imports System.Management

Dim mc As ManagementClass

Dim mo As ManagementObject

Dim moc As ManagementObjectCollection

Dim PortDescriptionArray() As String = {}

Dim I As Integer

mc = New ManagementClass("Win32_SerialPort")

moc = mc.GetInstances()

For Each mo In moc

If mo.Item("Status").ToString = "OK" Then

ReDim Preserve PortDescriptionArray(I)

PortDescriptionArray(I) = mo.Item("Description").ToString

I += 1

End If

Next
--
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.
Oct 24 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: rusttree | last post by:
Many moons ago, I took a class in embedded control at school. The course focused on a micro-controller mounted on a small electric car that was programmed using simple C code. The...
1
by: Mark Smith | last post by:
Hello Group, I am using the RASAPI to dial-to the internet using a GPRS modem using C#. Is it possible before dialling to retreive information about the COM port that the modem is connected...
13
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have...
2
by: Wouter van Teijlingen | last post by:
Dear Readers, I was reading about how to control the COM and LPT port using VB .NET. I've found a lot of information, and it was very useful to me. I found an example program on the site of...
9
by: google_groups3 | last post by:
Hi all. This is a bit of a long shot i think but right now i am all out of ideas, so any help is greatly appreciated! I have an app that sends information on a specific port. However, te...
4
by: Frank | last post by:
Hello, how to get information about all serial ports in the PC? I use the following code, but i got only the data of the FIRST serial port. All other serial port information are not available...
4
by: H J van Rooyen | last post by:
Hi All, I am writing a polling controller for an RS-485 line that has several addressable devices connected. It is a small access control system. All is well- the code runs for anything from...
4
by: cmdolcet69 | last post by:
This code below write a serial command to the com port then read the results and disaplays it into the label1.text property when button1_click event is triggered. I think what is going on is that...
7
by: Rob Dob | last post by:
The following code is giving me a timeout problem., no matter what I do I can't send a piece of mail using .net2.0 System.Net.Mail.SmtpClient via port 465 and using ssl, if however I try using...
9
by: markgoldin | last post by:
I am looking for code to listen to a tcp port. Another (not .net) process will be writing to that port on the same computer and I need c# code to be able to get data, which is a simple string,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.