I have recently started learning F#, and this is the first time I've ever used WinForms. Here is my code.
#light
open System
open System.Windows.Forms
let form =
let temp = new Form()
let ms = new MenuStrip()
let file = new ToolStripDropDownButton("File")
ignore(ms.Items.Add(file))
ignore(file.DropDownItems.Add("TestItem")) \\Code of importance
let things _ _ = ignore(MessageBox.Show("Hai"))
let handle = new EventHandler(things)
ignore(file.Click.AddHandler(handle))
let stuff _ _ = ignore(MessageBox.Show("Hai thar."))
let handler = new EventHandler(stuff)
let myButton = new Button(Text = "My button :>", Left = 8, Top = 100, Width = 80)
myButton.Click.AddHandler(handler)
let dc c = (c :> Control)
temp.Controls.AddRange([| dc myButton; dc ms |]);
temp
do Application.Run(form)
What the problem is, I can't seem to figure out how I would get a handle on the DropDownItems item so that I could use it. I'm sure it's something simple, but I haven't been using F# for that long. Thanks for any help.
edit: I'd also like to point out that I know there are alot of ugly syntax in that block of code, but the whole thing is just a test form I've been using.