How to Implement TextBox control in F#

In this Blog I am showing that how to show a TextBox in F# windows form application.

Example

open System
open System.Windows.Forms
 
let form =
// create a form
  let temp = new Form()
 
// create a text box and set its anchors
  let txtBx = new TextBox(Top=8,Left=8, Width=temp.Width - 24,
                          Anchor = (AnchorStyles.Left |||
                                    AnchorStyles.Right |||
                                    AnchorStyles.Top))
// add the text box to the form and return the form
  temp.Controls.Add(txtBx)
  temp

[<STAThread>]
do Application.Run(form)

Output

TextBox Output

Ebook Download
View all
Learn
View all