title: List available COM ports
body: <p>I have a very small code that shows available COM ports.</p>
  
  <p>My question is:</p>
  
  <p>Is there an easy way to have the program to run in the tray and only popup when a new COM port is available and is it possible to add the name for the COM port that you can see in device manager ec "USB serial port"?</p>
  
  <p>I often add/remove a USB->RS232 comverter and find it a pain in the ass because I must go into the device manger to see what COM port it is assigned to. It's not the same each time</p>
  
  <p>Maybe there already is a small app that can do this but I havent found it on Google yet</p>
  
  <pre><code>using System;
  using System.Windows.Forms;
  using System.IO.Ports;
  
  namespace Available_COMports
  
  {
      public partial class Form1 : Form
      {
          public Form1()
      {
          InitializeComponent();
  
          //show list of valid com ports
          foreach (string s in SerialPort.GetPortNames())
          {
              listBox1.Items.Add(s);
          }  
      }
  
      private void Form1_Load(object sender, EventArgs e)
      {
      }
  
      private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
      {
      }
  }
  </code></pre>
  
  <p>}</p>