Get a simple handler

  • Thread starter Thread starter Rob Willaar
  • Start date Start date
R

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
 
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
 
Rob said:
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.
 
Back
Top