Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7727157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:23:22+00:00 2026-06-01T05:23:22+00:00

I’m dealing with a bug relating to a C# WinForms app that starts up

  • 0

I’m dealing with a bug relating to a C# WinForms app that starts up with a splash screen, then closes the splash screen and opens a login form. On some computers everything works fine. On others, the login form appears, but with a flashing title bar, which after a few flashes, loses focus altogether. The cursor is still flashing in the “User name” text box, but the app does not have focus, and when you start typing, nothing happens, which is very annoying for the user.

There seems to be no difference what OS is running (we’ve tried Windows 7 and Server 2008), and we have been particular not to have any keyboard or mouse input after starting up the app.

Now – does anyone have any idea what could be causing the app to lose focus?
Alternatively, how would you debug this issue? We have been unable to replicate the problem in the Visual Studio debug environment, but that doesn’t entirely surprise me because I’d guess it’s an issue of how the compiled app interacts with the OS… or am I wrong?

EDIT #1: I thought this was solved by @vinodpthmn, by ensuring that the splash screen is properly closed before the login form appears, but this appears not to have helped. So I created a logger to track all the events and threads, and found the following interesting log entries:

Thread 01 - 2012/03/29 12:51:09.693 - Show splash screen
Thread 01 - 2012/03/29 12:51:20.350 - Splash screen closed
Thread 01 - 2012/03/29 12:51:20.490 - Login Form Activated
Thread 01 - 2012/03/29 12:51:20.522 - Login Form Load
Thread 01 - 2012/03/29 12:51:25.694 - Login Form deactivated
Thread 01 - 2012/03/29 12:51:25.694 - Active form =
Thread 01 - 2012/03/29 12:51:25.694 - Active app =

Those last lines showing the active form and app respectively display Form.ActiveForm and the currently active app in Windows (code for this here). And they are both empty/null. This is so, even if in the Login form Load I call Activate() or SetForegroundWindow() as suggested by @memetolsen. The login form never even receives focus!

Any ideas?

EDIT #2: Well, I just eliminated the splash screen, and now the login form gets focus. Replacing the splash screen reintroduces the bug. But I have put code in to ensure that the splash screen is disposed – not just closed – before I try to open the login form.

Could it make a difference that the splash screen is opened with Application.Run(frmSplash)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:23:23+00:00Added an answer on June 1, 2026 at 5:23 am

    Could it make a difference that the splash screen is opened with Application.Run(frmSplash)

    Certainly, doing it this way guarantees you’ll have this kind of problem. This trouble is caused because for a split second you have no window that can receive the focus. The splash screen is gone, your main window still needs a handful of milliseconds to get created and visible. This forces Windows to find another window to give the focus to. Since it can’t be your window, it will pick the window of another application. Your main window will not have the focus when appears.

    The exact rules that the window manager uses are not clear to me, this focus loss doesn’t always happen. I’m guessing it is time related.

    Solve your problem by using the excellent and trouble free support for splash screens that’s already built into the framework. You’ll find the code to use it in this answer. If you don’t want to use it then rework your code to ensure the main window is displayed before you close the splash screen.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.