Introduction
This article shows how to validate a user control in a Windows Forms form.
Step 1:
Open Visual Studio then select "Create New Project" --> "F# Console Application".

Step 2:
Now go the Solution Explorer on to the right side of the application. Right-click on "References" and select "Add references".


Step 3:
After selecting "Add References", in the framwork template you need to select "System.Windows.Forms" and "System.Drawing" while holding down the Ctrl key and Click on "Ok."

Step 4:
Write the following code in the F# editor:
// Learn more about F# at http://fsharp.net
open System.Collections.Generic
open System
open System.Windows.Forms
open System.ComponentModel
open System.Drawing
let validform = new Form(Text="Validate Inputs",AutoScaleDimensions=new System.Drawing.SizeF(60.0F, 13.0F),ClientSize=new System.Drawing.Size(300, 200),StartPosition=FormStartPosition.CenterScreen)
let exitbutton=new Button(Text="Exit", Location=new System.Drawing.Point(190, 170))
let okbutton=new Button(Text="Ok", Location=new System.Drawing.Point(100, 170))
let lblname=new Label(Text="Enter a name:",Location=new System.Drawing.Point(0, 10),AutoSize=true)




Bhuvanesh MohankumarPosted Apr 30, 2016, 3:16 PM
Good one...