|
-
Jan 31st, 2006, 03:07 PM
#1
Thread Starter
Hyperactive Member
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..
Last edited by Rattlerr; Jan 31st, 2006 at 05:55 PM.
-
Jan 31st, 2006, 03:23 PM
#2
Fanatic Member
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.
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Jan 31st, 2006, 03:25 PM
#3
Re: Socket_ConnectEvent Conversion
Slightly OT, butthis is a good reference for how to do the same things in both languages.
-
Jan 31st, 2006, 04:34 PM
#4
Thread Starter
Hyperactive Member
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??
-
Jan 31st, 2006, 05:10 PM
#5
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. 
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?
-
Jan 31st, 2006, 05:11 PM
#6
Thread Starter
Hyperactive Member
Re: Socket_ConnectEvent Conversion
 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....
-
Jan 31st, 2006, 05:14 PM
#7
Fanatic Member
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.
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Jan 31st, 2006, 05:21 PM
#8
Thread Starter
Hyperactive Member
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..
-
Jan 31st, 2006, 05:23 PM
#9
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.
-
Jan 31st, 2006, 05:24 PM
#10
Thread Starter
Hyperactive Member
Re: Socket_ConnectEvent Conversion
-
Jan 31st, 2006, 05:31 PM
#11
Re: Socket_ConnectEvent Conversion
I saw that one, I mean it's ENTIRETY 
Spare no details, we can handle it. 
.o0(or is that all you have?)
-
Jan 31st, 2006, 05:50 PM
#12
Thread Starter
Hyperactive Member
Re: Socket_ConnectEvent Conversion
I'm always reluctant too put up an entire project..
-
Jan 31st, 2006, 05:56 PM
#13
Fanatic Member
Re: Socket_ConnectEvent Conversion[RESOLVED]
Shoot, I was hoping to steal your 1337 code. 
7halo didn't mean the whole project, more like the class.
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Jan 31st, 2006, 05:57 PM
#14
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
-
Jan 31st, 2006, 06:06 PM
#15
Fanatic Member
Re: Socket_ConnectEvent Conversion[RESOLVED]
Isn't it great when threads get resolved despite our best efforts? (rhetorical)
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|