I am building a support application (VB.net 2010) for a device that will attach via USB. Most of the end users will not be geeks.
In starting the app I need to discover available ports on the machine, which I can do with this code.

        myPort = IO.Ports.SerialPort.GetPortNames() 'Get all com ports available
        For i = 0 To UBound(myPort)
            portChoice.Items.Add(myPort(i))
        Next

On my machine, it fills the combobox with COM1 and COM9. But...
If I go into the control panel, I can see "Arduino Mega" on COM9.

This is what I want to discover. This way the end user does NOT have to be geeky enough to use the control panel or work at setting the system up with each set up.

Any ideas that will point me in the right direction guys?

TIA!

Recommended Answers

All 6 Replies

What type of device is it? Is it a bluetooth device? Did you try searching the registry for COM9?

  • regedit
  • Edit
  • Find

search for: COM9

The device (I built myself) connects to a PC via USB and shows in the listing of available com ports.
I could modify the micro to respond to a poll and attach if the result is correct. But.. If the PC can identify the device at the end of a com port, that might be easier.

Using WMI, try looking in

  • Win32_PnPEntity
  • Win32_PnPSignedDriver

I got it.
I'm polling all of the ports one at a time. When the correct port responds with a particular string. Bingo!

Thanks. I'm going to keep searching for the other method as well...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.