3
Answers

List of Com Ports

Jagjit Saini

Jagjit Saini

13y
1.3k
1
Hi

using system.io.ports

   string[] ports =  SerialPort.GetPortNames();
        var sortedList = ports.OrderBy(port => Convert.ToInt32(port.Replace("COM", string.Empty)));
        foreach(string port in ports)
            {
                DrpPort.Items.Add(port);
                DrpPort.DataBind();
            }

It is not displaying anything in Drop-Down , it is not going in loop.

Thanks
Answers (3)