Jagjit Saini

Jagjit Saini

  • NA
  • 166
  • 0

List of Com Ports

Oct 4 2011 3:06 AM
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)