Identify Serial ports  
Author Message
Babak1





PostPosted: Visual C# General, Identify Serial ports Top

Hi,

I write an application in C# 2003. this program should list all the available serial ports on the computer and display it for the user. I tried with MSComm and AXMSComm to identify the Serial ports. But this components have only a function by the name of “commport” that return the index of one port to be used. Is there any way to identify all the serial ports and theirs name

Thanks for your help

/Babak


Visual C#4  
 
 
TaylorMichaelL





PostPosted: Visual C# General, Identify Serial ports Top

If you are running v2 then the SerialPort class will give you the list of ports.

For pre-v2 you can use WMI to get the ports. The Win32_SerialPort class defines a serial port. Query for all of them to get the entire list. For more information on using WMI refer to MSDN and search the forums. It is a popular topic and will return many examples for you to follow. The basic query you'll do is "SELECT * FROM Win32_SerialPort".

Michael Taylor - 12/7/06


 
 
Babak1





PostPosted: Visual C# General, Identify Serial ports Top

Thanks for your help. My problem is solved.

/Babak