title: Adding/Removing COM Ports from a ComboBox in C#
body: <p>I am attempting to write a program that utilizes a ComboBox to display currently connected COM ports obtained from the following method:</p>
  
  <pre><code>System.IO.Ports.SerialPort.GetPortNames()
  </code></pre>
  
  <p>The idea is to initialize a thread that checks the currently available COM ports every second, and update the ComboBox accordingly. Despite my best efforts, I can't get it to work.</p>
  
  <p>The code to update the ComboBox's contents is the following:</p>
  
  <pre><code>    private void Form1_Load(object sender, EventArgs e)
      {
          availPorts = new BindingList&lt;String&gt;();
  
          Thread t = new Thread(new ThreadStart(update));
          t.Start();
      }
  
      private void update()
      {
          this.comboBox1.DataSource = availPorts;
  
          while (true)
          {
              Console.WriteLine("CHECK");
  
              foreach (String port in System.IO.Ports.SerialPort.GetPortNames())
              {
                  if (!availPorts.Contains(port))
                  {
                      Console.WriteLine("FOUND");
                      availPorts.Add(port);
                  }
              }
  
              Thread.Sleep(1000);
          }
      }
  </code></pre>
  
  <p>I can see the console messages as the ports are found, however the ComboBox remains empty. Any help would be greatly appreciated.</p>