@wzl2:添加 Microsoft.VisualBasic 程序集引用;
using Microsoft.VisualBasic.Devices;
Computer c =new Computer();
int count = c.SerialPortNames.Count;
string name = c.SerialPortNames[0];
还是有错~~~用软件翻译的就是这样的语句~~~但还是有错,就不知道为什么了,reference也有加,using也加了,还是不可以
Error 2 'Microsoft.VisualBasic.Devices.Computer' does not contain a definition for 'SerialPortNames' and no extension method 'SerialPortNames' accepting a first argument of type 'Microsoft.VisualBasic.Devices.Computer' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\sadmin\Desktop\bbb\bbb\Form1.cs 53 27 bbb