如何修复错误COM异常未处理:来自HRESULT的异常:c#windows窗体中的0x800A9C46 [英] how to fix error COM Exception was unhandled: Exception from HRESULT:0x800A9C46 in c# windows forms

查看:144
本文介绍了如何修复错误COM异常未处理:来自HRESULT的异常:c#windows窗体中的0x800A9C46的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我的名字是3天的固定我一直在试图修复错误COM异常未处理:c#windows窗体中的 HRESULT:0x800A9C46 异常。



我在c#windows窗体中有一个名为: sckClient 的winsock控件。



我得到了winsock通过工具箱控制我的工具箱 - >右键单击 - >选择项目 - > COM组件 - > Microsoft WinSock控件,版本6.0。



我已包含名称空间:使用System.Net ;

使用System.Net.Sockets ;在我的c#窗体中



连接到服务器之后的任何方式我想通过定时器控件将数据发送到服务器。

下面给出的是c#code:

Hi my name is vishal for 3 days i have been breaking my head on how to fix error COM Exception was unhandled: Exception from HRESULT:0x800A9C46 in c# windows forms.

I have a winsock control named:sckClient in my c# windows forms.

I got winsock control in my toolbox through toolbox-> right click->choose items->COM Components-> Microsoft WinSock control,version 6.0.

I have included namespaces: using System.Net;
using System.Net.Sockets; in my c# windows forms

Any way after connecting to server i wanted to send data to server through a timer control.
Given below is c# code:

private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            sckClient.SendData("\u00fa" + "\u0000" + "\u0069" + "\u0000" + "\u0000" + "\u0000" + "\u0000" + "\u0000" + "\u0000" + "\u00fb");           
    }



但是在执行上面的代码时我收到错误消息(运行时错误):COM异常未处理:

来自HRESULT的异常:0x800A9C46

在以下行中:


But upon executing the above code i get error message(run-time error): COM Exception was unhandled:
Exception from HRESULT:0x800A9C46
in this below line :

sckClient.SendData("\u00fa" + "\u0000" + "\u0069" + "\u0000" + "\u0000" + "\u0000" + "\u0000" + "\u0000" + "\u0000" + "\u00fb");





但是我能够完成我在vb6代码中的任务。以下是vb6代码:



However i was able to accomplish my task which was in vb6 code. Given below is vb6 code:

Private Sub Timer1_Timer(index As Integer)
    On Error GoTo errh
    Timer1(index).Enabled = False
    
    If (Timer1(index).Tag = "") Then   'Sync API call
        sckClient(index).SendData Chr(250) & Chr(0) & Chr(105) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(251)
    Else    'Get Last test data API call
        sckClient(index).SendData Chr(250) & Chr(0) & Chr(104) & Chr("0") & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(251)
    End If
    Timer1(index).Tag = ""
    Exit Sub
errh:
    MsgBox "syncing error:" & Err.Description, vbCritical
End Sub



执行上面的vb6代码后,我将数据发送到服务器,我发送数据2500105000000251,表示服务器和客户端在连接时已连接。



任何人都可以有关如何使用sql server 2008在c#windows窗体中使用计时器获得相同结果的帮助,因为我能够在vb6中实现与Ms访问。



任何人都可以帮助我请?!任何人都可以帮助我/指导我如何解决我的问题。任何有关解决此问题的指导/帮助将不胜感激!


Upon executing the above vb6 code i get to transmit data to server where i transmit data 2500105000000251 indicating server and client has been connected upon connection.

Can anyone help on how to achieve the same result with timer in c# windows forms with sql server 2008 as i was able to achieve in vb6 with Ms access.

Can anyone help me please?! Can anyone help me/guide me on how to solve my problem.? Any guidance/help in solving of this problem would be greatly appreciated!

推荐答案

这篇关于如何修复错误COM异常未处理:来自HRESULT的异常:c#windows窗体中的0x800A9C46的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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