Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Referencing objects from within an event handler

Hi:
How do you get a reference to objects from inside an event handler? I have
a click event for a button and want to be able to manipulate some properties
of other objects in the class, but I can't seem to find a way to get at
them.
Thanx,
Charlie
[288 byte] By [Charles Fineblum] at [2007-11-9 18:22:00]
# 1 Re: Referencing objects from within an event handler
The usual pattern is to define the delegate like this:

EventHandler(object sender, EventArgs e);

Then you pass the sending object as part of the event, and the handler can
do something with it.

"Charles Fineblum" <cbf@radix.net> wrote in message
news:39bf7160@news.dev-archive.com...
> Hi:
>
> How do you get a reference to objects from inside an event handler? I
have
> a click event for a button and want to be able to manipulate some
properties
> of other objects in the class, but I can't seem to find a way to get at
> them.
>
> Thanx,
> Charlie
>
>
Eric Gunnerson at 2007-11-11 22:28:40 >