Socket_ConnectEvent Conversion[RESOLVED]
This is the line of code i need some help Converting..
VB Code:
Private Sub Socket_ConnectEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs)
Need that Converted I'v tried a Method but then i cant add the code that follows...
Thxs for the Help in Advance.. :)
Re: Socket_ConnectEvent Conversion
Do you mean the Handles keyword in VB.NET?
If so, it doesn't exist in C#, you should ad this to the constructor:
Code:
SocketThingy.ConnectEvent += new EventHandler(Socket_ConnectEvent)
If not, please elaborate.
Re: Socket_ConnectEvent Conversion
Slightly OT, butthis is a good reference for how to do the same things in both languages.
Re: Socket_ConnectEvent Conversion
I'v tried working this Socket a few ways here is the VB8 version::
VB Code:
Socket(Index).SendData(Data(ClientID(Index)))
This is what i have so far that should work::
VB Code:
private Socket[]socket;
short index = socket.GetIndex(eventSender);
socket[].Send(Data, ClientID[])
Only problem is under .Send "Class,struct or Interface must have a return type"
Then the , gets me a Identifier Expected...
any ideas??
Re: Socket_ConnectEvent Conversion
Can you use [ CODE] tags for the time being? I think they're still working, that's really hard to read. :sick:
It looks like you have an array of sockets you're attempting to ".Send". Is there a specific index you should be using? Maybe....
Code:
System.Net.Sockets.Socket[] socket1;
short index = socket1.GetIndex(eventSender);
socket1[index].Send(Data, ClientID[0]);
Nothing in the code specifies which ClientID you're using?
And nothing in the code is populating your socket array?
Re: Socket_ConnectEvent Conversion
Quote:
Originally Posted by grilkip
Do you mean the Handles keyword in VB.NET?
If so, it doesn't exist in C#, you should ad this to the constructor:
Code:
SocketThingy.ConnectEvent += new EventHandler(Socket_ConnectEvent)
If not, please elaborate.
I have added that to the constructor..But still haveing one heck of a time with just these few lines of code.... :ehh:
Re: Socket_ConnectEvent Conversion
Can you post the full function, because I haven't a clue as to what we are talking about currently.
Could be me though.
Re: Socket_ConnectEvent Conversion
ok here is the Entire VB8 Section of code i'm working on
Code:
Private Sub Socket_ConnectEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Socket.ConnectEvent
Dim Index As Short = Socket.GetIndex(eventSender)
Socket(Index).SendData(Data(ClientID(Index)))
End Sub
I have this in the Contstructor
Code:
Socket.ConnectEvent += new EventHandler(Socket_ConnectEvent)
But i just cant seem to convert the above VB8 ...
I tried your code sevenhalo but i still get compile errors on the [index] & ClientID..."Array size cannot be specified in a variable declaration(try intializing with a new expression) that is the error i receive...
The .Send Error is :: class,struct,or interface must have a return type.. :sick:
Re: Socket_ConnectEvent Conversion
I knew the code wasn't going to work, that's why I added the questions about it underneath :)
Can you post the code in it's entirety (with your declarations and all). I don't see a ConnectEvent anywhere in the Fx.
Re: Socket_ConnectEvent Conversion
Re: Socket_ConnectEvent Conversion
I saw that one, I mean it's ENTIRETY :)
Spare no details, we can handle it. :thumb:
.o0(or is that all you have?)
Re: Socket_ConnectEvent Conversion
I'm always reluctant too put up an entire project..
Re: Socket_ConnectEvent Conversion[RESOLVED]
Shoot, I was hoping to steal your 1337 code. :afrog:
7halo didn't mean the whole project, more like the class.
Re: Socket_ConnectEvent Conversion[RESOLVED]
Understandable, but if we can't see all of the rellevant code (ecspecially when you're trying to convert an entire project to a new language where anything can be out of place); I don't know what else to ask... Sorry :sick:
Re: Socket_ConnectEvent Conversion[RESOLVED]
Isn't it great when threads get resolved despite our best efforts? (rhetorical)