Results 1 to 2 of 2

Thread: [RESOLVED] Getting The Manufacturer Value From COM Port Properties

  1. #1

    Thread Starter
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Resolved [RESOLVED] Getting The Manufacturer Value From COM Port Properties

    Does anyone know of a managed/unmanaged way of getting the Manufacturer value from the Communications Port Properties screen? See attached picture.

    So far I have this, however it doesn't give me the Manufacturer name:

    vb.net Code:
    1. Public Sub WritePorts()
    2.     Using searcher As New System.Management.ManagementObjectSearcher("SELECT * FROM WIN32_SerialPort")
    3.         For Each port In searcher.Get()
    4.             Console.WriteLine(String.Join(Environment.NewLine, _
    5.                                           port.Properties.OfType(Of System.Management.PropertyData)().Select(Function(prop) _
    6.                               String.Format("{0}: {1}", _
    7.                                             prop.Name, _
    8.                                             If(prop.Value Is Nothing, "NULL", prop.Value.ToString()))).ToArray()))
    9.         Next
    10.     End Using
    11. End Sub

    Note: You will need to add a reference to System.Management if you want to run this code.
    Attached Images Attached Images  

  2. #2

    Thread Starter
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: Getting The Manufacturer Value From COM Port Properties

    Well, I figured this out, however I'm not sure if the solution is optimal. If I change "SELECT * FROM WIN32_SerialPort" to "SELECT * FROM WIN32_PnPEntity" then I can get this information.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width