Author Topic: SerialPort.GetPortNames returns Nothing  (Read 951 times)

Olakunle

  • Member
  • ***
  • Posts: 17
SerialPort.GetPortNames returns Nothing
« on: December 12, 2017, 02:08:23 pm »
Dear Ma,
Happy New Year in Advance. Thank you ma for your coding support up till this time. Please the challenge am currently having is on using the SerialPort.GetPortNames to return the Serial COM Port Names on the ComboBox of my Windows 10 Laptop using a Microsoft Visual C# Application. Each time I click the Command Button that execute the SerialPort.GetPortNames code, and then Click on the appropriate ComboBox to select a Serial Port Name, the ComboBox has no Serial Port Names returned by SerialPort.GetPortNames method.
Some online resources said that the problem with the serial port might be a permission issue, lack of serial port or corrupt registry. Please ma how can I verify each of these causes of the problem and also solve this problem. I mean that what are the ways that People with this type of Serial Port Problem are troubleshooting the Problem and also solving the Problem. Thanks.
Olakunle Olafiranye.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2734
    • Lakeview Research
Re: SerialPort.GetPortNames returns Nothing
« Reply #1 on: December 12, 2017, 04:17:07 pm »
Check Windows Device Manager to view serial ports (Ports, COM). If you see one or more serial ports:

Use a breakpoint to view what is being passed to the combobox.

Be sure the port you want is not being used by another application.

Olakunle

  • Member
  • ***
  • Posts: 17
Re: SerialPort.GetPortNames returns Nothing
« Reply #2 on: December 25, 2017, 05:06:32 pm »
Dear Mrs Jan Axelson,
The SerialPort.GetPortNames method have now worked properly. Thanks.
Olakunle Olafiranye.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2734
    • Lakeview Research
Re: SerialPort.GetPortNames returns Nothing
« Reply #3 on: December 27, 2017, 06:25:21 pm »
Glad you got it working. Thanks for reporting back!

GarRiney

  • Member
  • ***
  • Posts: 1
Re: SerialPort.GetPortNames returns Nothing
« Reply #4 on: June 26, 2018, 09:53:43 am »
Hi...i am a new user here. In my case GetPortNames appears to break when I add 40 virtual COM ports. I would like to know what it is doing behind the scenes to make sure I am not doing something wrong. I have verified that the driver is working correctly. I can open all 40 ports and transmit and receive data. It could be a registry error but it only occurs when going from 39 to 40 virtual ports.

http://percentagescalculator.com/
« Last Edit: July 30, 2018, 05:17:23 pm by GarRiney »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2734
    • Lakeview Research
Re: SerialPort.GetPortNames returns Nothing
« Reply #5 on: July 07, 2018, 03:01:03 pm »
Just a thought; check what's in the registry?

HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM

https://msdn.microsoft.com/en-us/library/system.io.ports.serialport.getportnames%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

How do I open and edit the Windows registry

https://www.computerhope.com/issues/ch001348.htm