Carl Nolan of Microsoft UK has put together a nice little WinForms template for F#. You can find it in the Visual Studio Gallery Online templates.

Remember: You can find lots of templates for F# under "New Project" -> "Online Templates" and searching for "fsharp".

You can also search for F# templates and install them directly on the Visual Studio Gallery website.

As you probably know, the WinForms designer in Visual Studio generates C# code, and it is common to use a C# front end with F# code behind. This template, however, is all-F#, which is good for testing stuff out and for programatically-generated UIs, and also for charting, which is currently Carl's main interest.

When the template is installed you get the following template added to your F# folder when creating a new F# project:

image

So what does this template do? The template creates a new project consisting of two F# files, MyForm.fs and Program.fs.

The MyForm.fs file provides the structure for a type derived from Form. It demonstrates the Form definition providing placeholders for adding forms to the control and hooking up both form and control events.

Don