Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have registered to a LostFocus event on a TextBox and yet the event is not catch - my guess is that someone else handled it.
I've tried using snoop but it only shows me the MouseDown and MouseUp events (and I need the LostFocus).
Any ideas on how can I find out?

Thanks

Update:
code sample for registering to the event

eventInfo.AddEventHandler(cloningObject, eventDelegate);
Posted
Updated 19-Jun-13 4:54am
v3
Comments
joshrduncan2012 19-Jun-13 10:45am    
huh?
[no name] 19-Jun-13 10:49am    
My guess is that you really did not register to catch the event. But that is just a guess since you did not post your code where we could possibly see where you might have gone wrong.
Shahare 19-Jun-13 10:55am    
Updated the question to show the location where I register to the event - not so clear but debugging shows I'm registering correctly.

1 solution

You shouldn't be using LostFocus, you should use the Enter and Leave events.

See here:

MSDN LostFocus Event[^]

The LostFocus event may not fire depending on how the UICues are handled. Either way, there is no way to cancel a LostFocus event, so even if somebody else did attach to it, it wouldn't unattach your event handler or stop it from being called.
 
Share this answer
 
Comments
Shahare 19-Jun-13 10:56am    
What does the first sentance means: "The LostFocus event may not fire depending on how the UICues are handled"? UICues???
Ron Beyer 19-Jun-13 11:01am    
Please read the first note in the link I posted, it has a reference to UICues, which is a flag enumeration for the UI cues on the object. Either way it boils down to use the Enter and Leave events instead of LostFocus.
Shahare 19-Jun-13 11:09am    
Didn't understood it all the way, and I'm also not happy with the state, but I'll try and find another way to get what I need. Thanks
samadhan_kshirsagar 20-Jun-13 2:51am    
Enhance your question?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900