Form Lost Focus

  • Thread starter Thread starter Jesse
  • Start date Start date
J

Jesse

I have searched and searched, with no luck.

I have a Form that has several event listeners in it (Keypresses, speech
recognition, afew others). When I click a component in the form (such as a
button), the form itself loses focus.

How can I get it back? I have tried this.Focus() from w/in the form in a
timer with no luck as well as several other things.

Thanks!
 
Hi Jesse,

I'm guessing you have some code that is causing the form to lose focus.
This code may well also preventing you from resetting it. Review your code
to see if there is any code that may do so, possibly with assistance of the
LostFocus event to determine when this happens.
 
Do you have anything in the Form Activate event? Try disabling all the form
events.

Cheers!
 
Jesse said:
I have searched and searched, with no luck.

I have a Form that has several event listeners in it (Keypresses,
speech recognition, afew others). When I click a component in the
form (such as a button), the form itself loses focus.

How can I get it back? I have tried this.Focus() from w/in the form
in a timer with no luck as well as several other things.

Instead of trying to make the Form regain focus, make the event handlers
work no matter what has focus.

Try this:
http://msdn2.microsoft.com/en-us/library/system.windows.forms.application.addmessagefilter.aspx
 
Back
Top