I have a friend that sent me a little chat program using winsock.
So, I started working on a little program as well.
His program is in VB 6, and I have VB.NET.
I got the control to work with my .NET environment, but I have noticed that a few things are different in .NET, and have been giving me tons of problems.
for example
This is the VB6 ConnectionRequest sub.VB Code:
Private Sub winsock_ConnectionRequest(ByVal requestID As Long)
When I choose my winsock control, and find ConnectionRequest it creates this..
VB Code:
Private Sub winsock_ConnectionRequest(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_ConnectionRequestEvent) Handles winsock.ConnectionRequest
I've seen winsock.Accept requestID all over the place, but this is an error, obviously because requestID isn't defined in the sub definition. So I tried to use sender. Also, when I do this, Visual Studio.NET changes the command to winsock.Accept(sender). I dont know if this is wrong or not, but it does not work.
As of right now I'm sitting at a rather nasty error: "Exception has been thrown by the target of an invocation." This comes up from this code...
VB Code:
Try winsock.Accept(sender) Catch ex As Exception MessageBox.Show(ex.Message) End Try
What am I doing wrong? or where can I find a .NET example of how to use winsock?




Reply With Quote