Click here to Skip to main content
13,096,858 members (79,716 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Dear sir,
My problem is that when i call event handler method in a simple method .Please help,thanks..
Posted 30-Nov-12 3:47am
Updated 30-Nov-12 4:01am
thursunamy 30-Nov-12 9:52am
Can you send piece of code ?
NeelmaniN 30-Nov-12 9:57am
THis is Eventhandler :

public void Keyload(object sender, EventArgs e)
actHook = new UserActivityHook();
actHook.KeyDown += new KeyEventHandler(MyKeyDown);
actHook.KeyPress += new KeyPressEventHandler(MyKeyPress);
actHook.KeyUp += new KeyEventHandler(MyKeyUp);

But How to call in Function(Only Function)
ryanb31 30-Nov-12 10:30am
And the problem is?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


Instead, create a method that the Event handler calls and call that instead.
You don't need to call an event handler directly, although you can - it's just not good practice.

If you must, then just call it - it is a method so you just need to provide the parameters.
MyKeyUp(myKey, new EventArgs());

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 30 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100