请问VC6++里的控件MSComm,则么在.Net下的C#实现.

解决方案 »

  1.   

    我现在做是主要是串口通讯的工作,以前用过VC6++的MSComm控件,现在写程序用的是.NET 的C#
    我在VS2003里好象没有看见有MSComm的控件
      

  2.   

    mscomm是VB里带的,是个ActiveX控件,注册之后,通过添加COM组件以ActiveX的方式使用
      

  3.   

    vs 2003 下没有 msComm 组件  .net framework 1.1
    vs 2005 下才有 msComm 组件   .net framework 2.0可以使用一个现成的 类,里面调用 WIN32 APIhttp://msdn.microsoft.com/msdnmag/issues/02/10/netserialcomm/ 
      

  4.   

    用C#写串口通讯的资料很少啊!有人能给点吗?我现在是用VS.net 2003
      

  5.   

    提醒一下.在处理OnComm事件的时候要先关闭中断,处理完了再打开中断不然会出现 中断嵌套的.切记切记
      

  6.   

    try
    {
    short Com=short.Parse(this.comboBox1.Text.Trim().Substring(3,1));
    //MessageBox.Show(this.comboBox1.Text.Trim().Substring(2,1));
    string Settings=this.Cb_Rate.Text.Trim()+",n,8,1";
    if(this.axMSComm1.PortOpen==true)
    {
    this.axMSComm1.PortOpen=false;
    this.axMSComm1.CommPort=Com;
    this.axMSComm1.Settings=Settings;
    this.axMSComm1.InputMode =MSCommLib.InputModeConstants.comInputModeBinary;//接收数据的类型 
    this.axMSComm1.RThreshold = 1; 
    this.axMSComm1.InputLen=0;
    this.axMSComm1.PortOpen=true;
    }
    }
    catch(Exception ex)
    {
    MessageBox.Show(ex.ToString());
    }