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 / Windows Forms / WinForm General / January 2008

Tip: Looking for answers? Try searching our database.

Windows Forms Strange Behavior

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Doug Holland - 16 Jan 2008 17:39 GMT
I have a Windows Forms application with an annoying bug in it that I cannot
seem to track down.

When an operation is performed by the user then in some cases the
application ceases to be the active Window. This is still the case if I use
the BackgroundWorker component to perform the operation asynchronously.

Any thoughts?

I've developed a bunch of Windows Forms applications over the years and have
never seen this behavior before.

Thanks,

Doug
AMercer - 16 Jan 2008 18:06 GMT
> When an operation is performed by the user then in some cases the
> application ceases to be the active Window. This is still the case if I use
> the BackgroundWorker component to perform the operation asynchronously.
> Any thoughts?

1.  Does the operation in question always cause the phenomenon, or only
sometimes?  I know you said 'in some cases', but could you be more specific?  
Do other operations also always/sometimes cause the phenomenon?

2.  What window becomes the active window?  Is it predictable and
reproducible?

3.  Does the operation launch any processes?  Does it interact with any
other processes?  In either case, the other process may take focus.

4.  How does the user indicate that he wants to perform the operation?  Some
keystrokes are handled by windows and some of these change focus (eg Alt+Tab).
Doug Holland - 16 Jan 2008 18:21 GMT
Actually the cause of the bug appears to be the MessageBoxOptions was set to
DefaultDesktopOnly.

Removing the MessageBox code that asked the user if they really wanted to
remove the entities solved the problem.

When I said "some cases" it actually turned out to be everytime I prompted
the user for confirmation. I've now corrected the code to use a static
factory method to create the appropriate MessageBoxOptions. The static
factory code is based upon the C# code in the MSDN documentation for CA1300
(static code analysis warning).

Thanks,

Doug

> > When an operation is performed by the user then in some cases the
> > application ceases to be the active Window. This is still the case if I use
[quoted text clipped - 13 lines]
> 4.  How does the user indicate that he wants to perform the operation?  Some
> keystrokes are handled by windows and some of these change focus (eg Alt+Tab).

Rate this thread:







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.