• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 662
  • Last Modified:

VB.NET WMI Does Not Detect Virtual COM Port

We were forced to use a USB-to-Serial adapter.  The attached code will not recognize the 'virtual serial port.'  Any way around this?  Or is this the way it is going to be when not using a 'TRUE' serial port?
Dim moReturn As Management.ManagementObjectCollection
        Dim moSearch As Management.ManagementObjectSearcher
        Dim mo As Management.ManagementObject
        moSearch = New Management.ManagementObjectSearcher("Select * from Win32_SerialPort")
        moReturn = moSearch.Get
 
        Dim Coms As New System.Collections.Specialized.StringCollection
 
        For Each mo In moReturn
 
            Coms.Add(CStr(mo.Properties.Item("DeviceID").Value))
 
            Debug.WriteLine("-----------------------------------")
            Debug.WriteLine("Win32_SerialPort instance")
            Debug.WriteLine("-----------------------------------")
            Debug.WriteLine("Description: {0}", CStr(mo.Properties.Item("Description").Value))
            Debug.WriteLine("DeviceID: {0}", CStr(mo.Properties.Item("DeviceID").Value))
            Debug.WriteLine("Name: {0}", CStr(mo.Properties.Item("Name").Value))
            Debug.WriteLine("Status: {0}", CStr(mo.Properties.Item("Status").Value))
        Next

Open in new window

0
jigdog
Asked:
jigdog
1 Solution
 
grayeCommented:
So, what does the following give you?

    For Each port As String In My.Computer.Ports.SerialPortNames
        debug.writeline(port)
    Next
0
 
jigdogAuthor Commented:
Don't I feel like an idiot.  Still getting used to the convenient new methods and props in .net.  thanks!!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now