Home All Groups Group Topic Archive Search About
Author
1 Apr 2006 7:12 AM
Rob Willaar
Hi All,

Like to get less code.
Can i get this to work without having de default handlers.

Private Sub GetDescription() Handles LB2.KeyUp, LB2.Click

Author
1 Apr 2006 11:12 AM
Ken Tucker [MVP]
Hi,

            No.  You need the sender as object.  The Click event is
expecting the second argument to be an mouseeventargs.  The keyup event is
expecting the second argument to be an keyeventargs.

Ken
--------------------------
Show quoteHide quote
"Rob Willaar" <anonym***@xs4all.nl> wrote in message
news:OUFnQuVVGHA.1740@TK2MSFTNGP14.phx.gbl...
> Hi All,
>
> Like to get less code.
> Can i get this to work without having de default handlers.
>
> Private Sub GetDescription() Handles LB2.KeyUp, LB2.Click
>
>
>
>
Author
1 Apr 2006 3:09 PM
Branco Medeiros
Rob Willaar wrote:
> Hi All,
>
> Like to get less code.
> Can i get this to work without having de default handlers.
>
> Private Sub GetDescription() Handles LB2.KeyUp, LB2.Click

I'm all for less code, too, but this approach won't get you there. =))

A method to handle an event must have the same signature of the event
it handles. If KeyUp and Click are the typical events we know and love,
then GetDescription can't handle them, because obviously their
signatures differ.

For this same reason, a handler can't handle events of different
signatures: notice that the signatures of KeyUp and Click don't match
each other.

It seems you must put appropriate handlers in place for each of the
events and have them call your GetDescription method...

Regards,

Branco.