Click here to Skip to main content
Sign Up to vote bad
good
See more: C#
Dear sir,
My problem is that when i call event handler method in a simple method .Please help,thanks..
Posted 30 Nov '12 - 3:47
Edited 30 Nov '12 - 4:01

Comments
thursunamy - 30 Nov '12 - 9:52
Can you send piece of code ?
NeelmaniN - 30 Nov '12 - 9:57
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:30
And the problem is?

1 solution

Don't.
 
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());
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 286
1 Mohammed Hameed 208
2 Sergey Alexandrovich Kryukov 188
3 Santhosh G_ 108
4 Mayur_Panchal 98
0 Sergey Alexandrovich Kryukov 8,216
1 OriginalGriff 6,271
2 CPallini 3,528
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 30 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid