P
Peter Oliphant
I've written a few event handler methods in my time. Most of them are of the
general form:
void EventHandler( Object^ o, EventArgs^ e )
{
}
However, in all of these I've written, and in every example I've ever seen
on MSDN, the "Object^ o" is NEVER used! What exactly is it, and why is it
there if even MS never seems to use it?
Every example I've seen lists it as 'Object^ /*sender*/', indicating it is
the 'sender' (whatever that means), and it's parameter being commented out
means it doesn't seem like it is ever used. Since it is of type Object^ I'm
guessing it must be typecast to be at all useful.
Most sample code, and everything I've ever written just strips this Object
paramater out or ignores it, and nothing seems to go wrong.
What is it for, and when/how is it useful?
[==Peter==]
general form:
void EventHandler( Object^ o, EventArgs^ e )
{
}
However, in all of these I've written, and in every example I've ever seen
on MSDN, the "Object^ o" is NEVER used! What exactly is it, and why is it
there if even MS never seems to use it?
Every example I've seen lists it as 'Object^ /*sender*/', indicating it is
the 'sender' (whatever that means), and it's parameter being commented out
means it doesn't seem like it is ever used. Since it is of type Object^ I'm
guessing it must be typecast to be at all useful.
Most sample code, and everything I've ever written just strips this Object
paramater out or ignores it, and nothing seems to go wrong.
What is it for, and when/how is it useful?
[==Peter==]