Hi all,

When you click a control, OnClick is called which in turn calls the Click
event. OnClick takes as an argument an object of type EventArgs which it
then passes to Click. However, the default behavior is that the EventArgs
that is sent is an empty one. I want to pass in some values in my EventArgs
when the user clicks my control. How do I do this?

Thanks,

Nima

Re: How to pass an EventArgs to OnClick upon clicking a control by Sean

Sean
Fri Feb 18 22:14:21 CST 2005

Override OnClick
"Nima" <Nima@discussions.microsoft.com> wrote in message
news:B6612FB6-4F44-4E76-9AA0-58455A4000F3@microsoft.com...
> Hi all,
>
> When you click a control, OnClick is called which in turn calls the Click
> event. OnClick takes as an argument an object of type EventArgs which it
> then passes to Click. However, the default behavior is that the EventArgs
> that is sent is an empty one. I want to pass in some values in my
> EventArgs
> when the user clicks my control. How do I do this?

Override OnClick:

protected virtual OnClick(EventArgs e) { // e will be EventArgs.Emppty
MyEventArgs eventArgs = new MyEventArgs();
base.OnClick(eventArgs);
}

>
> Thanks,
>
> Nima
>
>
>
>