有多少个COM端口? [英] How many COM ports are there?

查看:129
本文介绍了有多少个COM端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用c#的系统上可用的COM端口列表.
有帮助,请参考

在此先感谢
:)

I need list of COM port available on system using c#.
Any help, reference reagrding

Thanks in advance
:)

推荐答案

我想您很快就会在Serialport类上进行阅读,因此这里是您入门的链接. >
http://msdn.microsoft.com /en-us/library/system.io.ports.serialport.getportnames(v=VS.90).aspx [
I imagine you''ll be reading up on the Serialport class fairly soon, so here''s the link to get you started.

http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.getportnames(v=VS.90).aspx[^]

Alan.


添加名称空间:使用System.IO.Ports;//

string [] ports = System.IO.Ports.SerialPort.GetPortNames();

foreach(端口中的字符串s)
{
comboBox1.Items.Add(s);
}
Add namespace: using System.IO.Ports;//

string[] ports = System.IO.Ports.SerialPort.GetPortNames();

foreach (string s in ports)
{
comboBox1.Items.Add(s);
}


使用WMI.我不知道具体细节,但是我敢肯定,如果您用Google搜索"C#WMI检测串行端口",您将获得数千次点击.
Use WMI. I don''t know the specifics, but I''m sure if you google "C# WMI detect serial ports", you''ll get thousands of hits.


这篇关于有多少个COM端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆