We'll look into why the error message is poor here, but here's the fix - just declare the type variable. Type variables are not automatically generalized for type definitions - you must declare them.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 

#light
open System.Drawing
open System.Windows.Forms
open System
type ui_selection_multiple<'a> = 
    class
        inherit Form
        val mutable names : array<'a>
        val mutable lb : CheckedListBox
        val mutable bt : Button
        new(names) as this = 
             {names = names ;lb=null;bt=null}
            then
                let bt = new Button()
                bt.Text <- "Go"
                bt.DialogResult <- DialogResult.OK
                let lb = new CheckedListBox()
                lb.CheckOnClick <- true 
                this.Controls.Add(lb)
                this.Controls.Add(bt)
                lb.Dock <- DockStyle.Fill
                bt.Dock <- DockStyle.Bottom
                let tmp = Array.map (fun name -> lb.Items.Add(name)) names
                this.bt <- bt
                this.lb <- lb
                ()
        member this.selected_list() =
            let selected =  IEnumerable.untyped_to_typed this.lb.CheckedItems
            IEnumerable.to_array selected
end
By on 10/31/2006 5:38 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper