Handling Events in C++.NET

Ralphzehunter

Newcomer
Joined
Nov 8, 2004
Messages
11
This is probably a really stupid question, but how can I handle events for an object I create in the code? For example: I have a Client, and Server, and using sockets, I can get them to connect, but how can I handle the Connected event?
btw I'm a real newbie at this....I got C++.NET yesterday lol
 
Connected isn't an event....is it. So the only way to check if a socket is connected is by putting a timer on the form, and checking to see if Connected == true?
At least by this mistake I found out how to handle events. (Thanks Windows Form Designer!)
 
Sorry I didn't explain myself

Sorry, I just meant how to handle events, for example a button's click event, I realized after looking that Connected for a socket is not an event. I found that handling events is done like this:
Code:
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
Sorry about confusing you.
Is that the proper way to do it?
 
Back
Top