Detecting USB to RS232 converter when connecting or disconnected
<p>After much head scratching I managed to find the com port number of the USB to RS232 converters on my system. I have 15 in the present system. <strong>What I now need to do is detect when one is connected or disconnected</strong> so that I can update my table. I can work out how to detect a USB Storage device but the same does not work for USB to RS232 converters. Does anyone have any idea on how I can detect this please?</p>

<p>Here is the code snippet I use to work out the com ports in use by the converters   </p>

<pre><code>private void btn_tst2_Click(object sender, EventArgs e)
{          
    ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2",
    "SELECT * FROM Win32_PnPEntity WHERE ClassGuid=\"{4d36e978-e325-11ce-bfc1-08002be10318}\"");

    foreach (ManagementObject queryObj in searcher.Get())
    {
        rtxbx_output.AppendText(queryObj["Name"].ToString() +"\r");
    }

}
</code></pre>