Link to home
Start Free TrialLog in
Avatar of jigdog
jigdogFlag for United States of America

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of graye
graye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jigdog

ASKER

Don't I feel like an idiot.  Still getting used to the convenient new methods and props in .net.  thanks!!