相关疑难解决方法(0)

获取串口信息

我有一些代码将串行端口加载到一个组合框中:

     List<String> tList = new List<String>(); 

     comboBoxComPort.Items.Clear();

     foreach (string s in SerialPort.GetPortNames())
     {
        tList.Add(s);
     }

     tList.Sort();
     comboBoxComPort.Items.Add("Select COM port...");
     comboBoxComPort.Items.AddRange(tList.ToArray());
     comboBoxComPort.SelectedIndex = 0;
Run Code Online (Sandbox Code Playgroud)

我想将端口描述(类似于设备管理器中的COM端口所示)添加到列表中,并对列表中位于索引0之后的项进行排序(已解决:请参阅上面的代码段).有没有人有任何关于添加端口描述的建议?我使用的是Microsoft Visual C#2008 Express Edition(.NET 2.0).您可能有任何想法,将不胜感激.谢谢.

c# sorting combobox serial-port

31
推荐指数
6
解决办法
10万
查看次数

标签 统计

c# ×1

combobox ×1

serial-port ×1

sorting ×1