open System
open System.Windows.Forms
open System.ComponentModel
open System.Drawing
let valform = new Form(Text="Input Validation")
let lblname=new Label(Top=20,Left=20)
let nametxtbox=new TextBox(Top=20,Left=120,Width=120)
let okbutton=new Button(Top=70,Left=80)
let exitbutton=new Button(Top=70,Left=170)
lblname.Text<-"Enter a name :"
exitbutton.Text<-"Exit"
okbutton.Text<-"Ok"
valform.Controls.Add(exitbutton)
valform.Controls.Add(okbutton)
valform.Controls.Add(lblname)
valform.Controls.Add(nametxtbox)
okbutton.Click.Add(fun ok->
if (Char.IsLetter(Convert.ToChar(nametxtbox.Text.Chars(0)))) then
MessageBox.Show(nametxtbox.Text+" "+"is valid name", "Letter Validation",MessageBoxButtons.OKCancel, MessageBoxIcon.Information)|>ignore
if (Char.IsNumber(Convert.ToChar(nametxtbox.Text.Chars(0)))) then
MessageBox.Show(nametxtbox.Text+" "+ "invalid name", "Num Validation",MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning)|>ignore)
exitbutton.Click.Add(fun exit->valform.Close())
Application.Run(valform)