Using the ultra-simple code below, as soon as I press a key on my keyboard while the form is in focus, the form completely locks up. I’m running this inside of F# interactive. The only way to close the form is by clicking “Reset Session” in F# interactive. I’ve tried adding event handlers to KeyPress, with the same results. I’ve had no problem adding mouse event handlers, menus, combo boxes etc.
I must be doing something wrong, as something as obvious as pressing a key on a keyboard probably shouldn’t be a bug at this point for F#. Any ideas?
// Add reference to System.Windows.Forms to project
open System.Windows.Forms
let a = new Form()
a.Visible <- true
I’m using F# 2.0 for Windows + Visual Studio 2008 (April 2010 release) on Windows XP.
Thanks!
I think you need a call to
but I don’t have time to try and verify right now.
EDIT:
A useful thing to do is: create a C# Windows Form project, and see what code it starts you off with. It gives you this:
so of course you can do the same in F#: