在crystalreports应用程序中使用MSCOMM32.OCX应用程序、crystalreports、OCX

2023-09-04 01:27:31 作者:空城旧梦

我使用VS 2010与SAP水晶报表VS 2010年时,我使用Microsoft通信控制(MSCOMM32)与我的USB调制解调器水晶repororts应用程序进行通信,并运行该应用程序,我得到这个错误。 无法加载文件或程序集Interop.MSCommLib,版本= 1.1.0.0,文化=中性公钥= null或它的一个依赖。试图用不正确的格式加载程序。 而当我移去那些所谓MSCOMM32控制从我的水晶报表应用程序它的工作原理/运行良好。 我没有收到使用MSCOMM32控制,如果我不使用水晶报告与我的C#.NET应用程序的任何错误。 谁能PLZ解决这个问题?

I'm using vs 2010 with sap crystal reports for vs 2010. when I'm using Microsoft communication control (MSCOMM32) to communicate with my USB Modem in crystal repororts application and running the application, I'm getting this error. Could not load file or assembly 'Interop.MSCommLib, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. while when I romove MSCOMM32 control from my crystal report application it works/runs fine. I'm not getting any error using MSCOMM32 Control if I don't use crystal report with my C#.Net application. Can anyone plz solve this problem??

推荐答案

为什么要使用这种旧的控制象MSCOMM32发送短信。尝试使用串行端口。听到是使用串行端口而不是MSCOMM32的code例如

why to use such an old control like Mscomm32 for sending sms. try using Serial port instead. hear is the code example for using serial port instead of MSCOMM32

private void btnsend_Click(object sender, EventArgs e)
    {
        using (var sp = new SerialPort("COM4"))
        {
            sp.Open();
            sp.WriteLine("AT" + Environment.NewLine);
            sp.WriteLine("AT+CMGF=1" + Environment.NewLine);
            sp.WriteLine("AT+CMGS=\"" + "phone no" + "\"" + Environment.NewLine);
            sp.WriteLine("your text message" + (char)26);
        }
    }
 
精彩推荐
图片推荐