Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / April 2008

Tip: Looking for answers? Try searching our database.

Form Lost Focus

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jesse - 28 Apr 2008 04:39 GMT
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!
Morten Wennevik [C# MVP] - 28 Apr 2008 06:13 GMT
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.

Signature

Happy Coding!
Morten Wennevik [C# MVP]

> I have searched and searched, with no luck.
>
[quoted text clipped - 6 lines]
>
> Thanks!
Tantr Mantr - 28 Apr 2008 09:26 GMT
Do you have anything in the Form Activate event? Try disabling all the form
events.

Cheers!

> I have searched and searched, with no luck.
>
[quoted text clipped - 6 lines]
>
> Thanks!
Ben Voigt [C++ MVP] - 29 Apr 2008 19:08 GMT
> I have searched and searched, with no luck.
>
[quoted text clipped - 4 lines]
> 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.addmes
sagefilter.aspx


> Thanks!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.