calling an event?

  • Thread starter Thread starter Flip
  • Start date Start date
F

Flip

I have an event on my form which is on the keyup event. In another part of
the form, I want to be able to call that logic. I have tried calling that
even method with passing (null, null) and things worked. But my "spidey
sense" tells me that's not the correct way to do it. Is there a
better/right way to do this?

Thanks.
 
Flip,

Well, it's not completely incorrect, but it's not the right way to do
it. Rather, what you should do is have a method that takes the key that was
pressed (if needed) and then performs the logic. Then, you can call that
method from your event handler, and anywhere else you need. The event
handler typically has a name which doesn't accurately describe what is
happening, and makes the code harder to understand.

Hope this helps.
 
Back
Top