Why not just overload it?
xyz(object sender, System.EventArgs e)
{
xyz(null, null)
}
xyz()
{
.....
}
Chris
"Tee" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
>
> As topic,
>
> Can we add an event handler that has different delegate?
>
> Example:
>
> I have a method that takes no parameter:
> public void xyz()
>
> I would like button1 to fire that method onclick.
> button1.Click += new EventHandler(xyz)
>
> I understand that button click event should has parameter like this :
> (object sender, System.EventArgs e)
>
> But what if I want to "force" it add the method? Or at least maybe make a
> convert on runtime, like convert xyz() to xyz(object sender,
> System.EventArgs e), and pass in (null, null).
>
> Can I achieve that?
>
>
> Thanks,
> Tee
>
>
|