Skip to content

Instantly share code, notes, and snippets.

@evilz
Forked from joastbg/gist:3946351
Created July 31, 2019 08:31
Show Gist options
  • Save evilz/52b68b8ce0296f914312ad1ad8470399 to your computer and use it in GitHub Desktop.
Save evilz/52b68b8ce0296f914312ad1ad8470399 to your computer and use it in GitHub Desktop.
Data grid in F#
// The form
let form = new Form(Visible = true, Text = "Data grid #1",
TopMost = true, Size = Drawing.Size(600,600))
// The grid
let data = new DataGridView(Dock = DockStyle.Fill, Text = "Data grid",
Font = new Drawing.Font("Lucida Console", 10.0f),
ForeColor = Drawing.Color.DarkBlue)
form.Controls.Add(data)
// Some data
data.DataSource <- [| ("ORCL", 32.2000, 31.1000, 31.1100, 0.0100);
("MSFT", 72.050, 72.3100, 72.4000, 0.0900) |]
// Set column headers
do data.Columns.[0].HeaderText <- "Symb"
do data.Columns.[1].HeaderText <- "Last sale"
do data.Columns.[2].HeaderText <- "Bid"
do data.Columns.[3].HeaderText <- "Ask"
do data.Columns.[4].HeaderText <- "Spread"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment