请问一般是用啥控件?PComm??听说VS.NET2005有自己的,有谁用过吗?
谁能给点例子?

解决方案 »

  1.   

    using System.IO.Ports;打开com3
     this.serialPort1.PortName = "COM3";
     this.serialPort1.StopBits = StopBits.One;
     this.serialPort1.Open();
    写数据
    this.serialPort1.Write("strings");  
    读数据
     private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
            {
                this.listBox1.Items.Add(this.serialPort1.ReadLine());
            }
    记住要关闭串口
    this.serialPort1.Close();
      

  2.   

    上面是在2005bate2下的应用串口操作方法
      

  3.   

    http://www.microsoft.com/china/MSDN/library/enterprisedevelopment/softwaredev/code4fun12102003.mspx
      

  4.   

    好象NET操作串口功能不强大吧,用C++吧
      

  5.   

    绝倒,凡尘 的例子,这么简单?this.serialPort1.Write("strings");  这个写的是 "strings"的unitcode编码的bytes流?
    可以直接写byte数组的吧?应该由不同的重载函数的吧?下面读数据 
     private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
            {
                this.listBox1.Items.Add(this.serialPort1.ReadLine());
            }
    是数据来了触发事件, 添加事件处理代理的意思,看上去像。也就是说serialPort1这种类有这样的
    事件?very good..