WindowsFormsApplicationBase SplashScreen makes login form ignore keypresses until I click on it - how to debug?

Posted by Tom Bushell on Stack Overflow See other posts from Stack Overflow or by Tom Bushell
Published on 2010-12-22T21:37:46Z Indexed on 2010/12/23 19:54 UTC
Read the original article Hit count: 212

Filed under:
|
|
|

My WinForms app has a simple modal login form, invoked at startup via ShowDialog(). When I run from inside Visual Studio, everything works fine. I can just type in my User ID, hit the Enter key, and get logged in.

But when I run a release build directly, everything looks normal (the login form is active, there's a blinking cursor in the User ID MaskedEditBox), but all keypresses are ignored until I click somewhere on the login form. Very annoying if you are used to doing everything from the keyboard.

I've tried to trace through the event handlers, and to set the focus directly with code, to no avail.

Any suggestions how to debug this (outside of Visual Studio), or failing that - a possible workaround?

Edit

Here's the calling code, in my Main Form:

    private void OfeMainForm_Shown(object sender, EventArgs e)
    {
        OperatorLogon();
    }

    private void OperatorLogon()
    {
        // Modal dialogs should be in a "using" block for proper disposal
        using (var logonForm = new C21CfrLogOnForm())
        {
            var dr = logonForm.ShowDialog(this);

            if (dr == DialogResult.OK)
                SaveOperatorId(logonForm.OperatorId);
            else
                Application.Exit();
        }
    }

Edit 2

Didn't think this was relevant, but I'm using Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase for it's splash screen and SingleInstanceController support.

I just commented out the splash screen code, and the problem has disappeared. So that's opened up a whole new line of inquiry...

Edit 3

Changed title to reflect better understanding of the problem

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms