הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Monday, July 25, 2011 6:43 AM
Hi My Friends
I have a Windows form.
in windows form have a combo box that give me a list of available port serial with it code (Dim ports As String() =SerialPort.GetPortNames())
for example( Com1,Com8,Com15,...).
but I want to give me fullname of serial port in device manager for example in dvice manager is these (Comunication Port(COM1) - Printer Port(LPT1) And USB Serial Port(COM8)).
how to Get it?
Thanks a lot
Best Regard Fatemeh AmirAfshar
All replies (2)
Tuesday, July 26, 2011 5:55 PM ✅Answered | 1 vote
Hi My Friends
I have a Windows form.
in windows form have a combo box that give me a list of available port serial with it code (Dim ports As String() =SerialPort.GetPortNames())
for example( Com1,Com8,Com15,...).
but I want to give me fullname of serial port in device manager for example in dvice manager is these (Comunication Port(COM1) - Printer Port(LPT1) And USB Serial Port(COM8)).
how to Get it?
Thanks a lot
Best Regard Fatemeh AmirAfshar
COMs are serial ports and LPT is the parallel (usually printer and imaging device) port. If you decide to go with WMI, you can get full port names using WMI like this:
' Add reference to System.Management.dll.
** Try**
** Dim searcher As New ManagementObjectSearcher( _**
** "root\cimv2", _**
** "SELECT * FROM Win32_SerialPort")**
** For Each queryObj As ManagementObject In searcher.Get()**
** MsgBox(queryObj("Name"))**
** Next**
** Catch err As ManagementException**
** MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)**
** End Try**
to get parallel (LPT) port name:
' Add reference to System.Management.dll.
** Try**
** Dim searcher As New ManagementObjectSearcher( _**
** "root\cimv2", _**
** "SELECT * FROM Win32_SerialPort")**
** For Each queryObj As ManagementObject In searcher.Get()**
** MsgBox(queryObj("Description"))**
** Next**
** Catch err As ManagementException**
** MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)**
** End Try**
HTH.**
**
Best regards, Saygılarımla, Onur Güzel
[Yazgeliştir Forumları VB.NET / C# Süper Moderatorü.
](http://forum.yazgelistir.com/User_Profile.aspx?userId=878&siteId=0)Microsoft Haber Grupları Profilim (VB.NET)
Tuesday, July 26, 2011 6:22 AM | 1 vote
Did you try the WMI solution I showed you in your previous question, with that one you can get all the available information around ports there is. Success
Cor