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");
}
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");
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
sckClient(index).SendData Chr(250) & Chr(0) & Chr(105) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(251)
Else
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
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!