查找当前电脑上有哪些串口
using System.IO; using System.IO.Ports; private void button1_Click( object sender, EventArgs e) { // 用以下方法知道此 // 方法一:comboBox1.Items.AddRange(System.IO.Ports.SerialPort.GetPortNames()); // 方法二: string[] portList = System.IO.Ports.SerialPort.GetPortNames(); for ( int i = 0; i < portList.Length; ++i) { string name = portList[i]; comboBox1.Items.Add(name); } }