Hi Chris,

AFAIK the reason for this error is, that the panel.Margin property returns a value class (i.e. System.Windows.Forms.Padding) which is copied and not referenced. Thus your modification would not actually modify the panel object. If you try the same in C# it would also fail to compile.

What you want can be achieved like this (transcript from FSI):

> open System.Windows.Forms;;
> let p = new Panel();;
val p : Panel
> p.Margin.All;;
val it : int = 3
> let mutable m = p.Margin;;
val mutable m : Padding
> m.All <- 8;;
val it : unit = ()
> p.Margin <- m;;
val it : unit = ()
> p.Margin.All;;
val it : int = 8

-Levi

By on 8/21/2008 12:57 PM ()

Levi,

Thanks for your help.

Regards

Chris

By on 8/25/2008 9:09 AM ()
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