Getting Serial Port Information and Sorting the Results in C#
- by Jim Fell
I have some code that loads the serial ports into a combo-box:
comboBoxComPort.Items.Add("Select COM port...");
foreach (string s in SerialPort.GetPortNames())
{
comboBoxComPort.Items.Add(s);
}
comboBoxComPort.SelectedIndex = 0;
Ideally, I would like to add the port descriptions to the list and sort the items in the list that are after index 0. Does anyone have any suggestions for doing this? Any thoughts you may have would be appreciated. Thanks.