Using the framework from F#

Just by typing the open statement, you can use the .NET Framework, or any other referenced libraries. To access the Console type, just add the following line to your source code:

open System

This program uses the built-in library function printfn, and then the WriteLine function to write “Hello world” to the screen.

printfn "Hello world"
open System
Console.WriteLine("Hello world")

So, displaying a message box, is just a matter of adding a reference to System.Windows.Forms, and this is how it could be done:

let x=System.Windows.Forms.MessageBox.Show("Hello world")

Or like so:

open System.Windows
let y=Forms.MessageBox.Show("Hello world")

Or even:

open System.Windows.Forms
let z=MessageBox.Show("Hello world")

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *