Skip to content

Instantly share code, notes, and snippets.

@MattMS MattMS/BasicWinForms.fs
Last active Jul 20, 2019

Embed
What would you like to do?
Basic F# WinForms demo
open System
open System.Windows.Forms
let makeButton label click =
let button = new Button()
button.Text <- label
let clickHandler = new EventHandler(click)
button.Click.AddHandler clickHandler
button
let helloClick o e =
MessageBox.Show "Hiya" |> ignore
type MyForm() as form =
inherit Form()
do
form.Controls.Add (makeButton "Hello there" helloClick)
[<STAThread>]
do
Application.EnableVisualStyles()
Application.Run(new MyForm())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.