private void BtnFindSerialPort_Click(object sender, EventArgs e)
{
foreach (string ports in System.IO.Ports.SerialPort.GetPortNames())
{
MessageBox.Show("Serial port avialible" + " " + ports);
}
}With this sample code you can identify the available serial port on the PC, running a ForEach iteration SerialPortNames property and GetPortNames method c#.
