Identify the Available Serial Port on the PC using C#

  1. private void BtnFindSerialPort_Click(object sender, EventArgs e)   
  2. {   
  3.      foreach (string ports in System.IO.Ports.SerialPort.GetPortNames())   
  4.      {   
  5.          MessageBox.Show("Serial port avialible" + " " + ports);   
  6.      }   
  7. }