Solved

VB.NET WMI Does Not Detect Virtual COM Port

Posted on 2008-06-18
2
641 Views
Last Modified: 2013-12-27
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
Comment
Question by:jigdog
2 Comments
 
LVL 41

Accepted Solution

by:
graye earned 500 total points
Comment Utility
So, what does the following give you?

    For Each port As String In My.Computer.Ports.SerialPortNames
        debug.writeline(port)
    Next
0
 

Author Closing Comment

by:jigdog
Comment Utility
Don't I feel like an idiot.  Still getting used to the convenient new methods and props in .net.  thanks!!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Hi there, This article summarizes what you need if you are going to set up your home or small business Network Attached Storage (NAS) to be accessible from the internet. Of course there are configuration differences based on your NAS or router ma…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now