open System
open System.Windows.Forms
open System.Drawing
let
form=new Form()
form.Text<-
"My Window Application"
form.BackColor <-Color.Gray
let
btn=new Button()
btn.Text<-
"Click"
btn.BackColor<- Color.Green
btn.Click.Add(fun
a-> MessageBox.Show("Hi")
|>ignore)
form.Controls.Add(btn)
Application.Run(form)
Then run the application. The output will be look like below figure.

When We Click on Button, MessageBox is displayed with message "Hi". Like below figure.

Join the conversation! Your thoughts help the community grow.