EventArgs

J

John Dann

Sorry I've forgotten what parameter for EventArgs to pass to a button
click-handling event handler if I simply want to call it from code, ie

Button_click(Me, ???)

(I presume that it is acceptable practice to call the click handler
directly from other code? The other option could be to place the click
handler code in a separate subroutine (ClickHandler) which could be
called both from the click handling event procedure and also from
anywhere else that it might be relevant without worrying about the
event arguments. But OTOH introducing unnecessary 'nesting' makes the
code less readable overall.)

JGD
 
H

Herfried K. Wagner [MVP]

John Dann said:
Sorry I've forgotten what parameter for EventArgs to pass to
a button click-handling event handler if I simply want to call
it from code, ie

Button_click(Me, ???)

'EventArgs.Empty'. But I prefer calling the button's 'PerformClick' method
(which will only fire the event if the button is visible and enabled).
directly from other code? The other option could be to place the click
handler code in a separate subroutine (ClickHandler) which could be
called both from the click handling event procedure and also from
anywhere else that it might be relevant without worrying about the
event arguments.

That's IMO the preferred way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top