Search code examples
.netwindowswinformskeyboardkiosk

Full Screen Windows Forms form ignoring keyboard input until clicked


The problem is that as soon as the login form appears, the user sees the cursor in the password textbox blinking (focus is programatically set), and types in the password, but keyboard input is completely ignored until the textbox is clicked with the mouse.

In development boxes, this does not happen, even with machines with just one monitor. I have a typical login form (which extends System.Windows.Forms.Form) with a user name combo box and a password textbox. In production machines, the app runs in a kiosk environment of sorts, without Windows Explorer (we use a .bat and a registry key to have only our app start when Windows starts). This is definitely related to the issue, but I can't figure out how. I configured a notebook this way in order to reproduce and test the issue.

Any ideas?


Solution

  • Random shot in the dark: call this.Activate() in an event handler for the form's Shown event. Which ensures the window is activated and in the foreground.