all groups > dotnet windows forms designtime > april 2006 >
You're in the

dotnet windows forms designtime

group:

Need CodeDomSerializer?


Need CodeDomSerializer? vrml97 NO[at]SPAM gmail.com
4/27/2006 6:59:45 PM
dotnet windows forms designtime:
Hi ,
I have a user control using custom class as property,

Custom Class,
public class myMarginBound : System.Drawing.Printing.Margins
{
public myMarginBound()
{

}
}

User control,
public class UserControl1 : System.Windows.Forms.UserControl
{
....................

public myMarginBound MBound

{
set
{

}
get
{
return new myMarginBound ();
}
}
}

Windows App,

Designer generate
this.userControl11.MBound =
((WindowsControlLibrary1.myMarginBound)(new
System.Drawing.Printing.Margins(100, 100, 100, 100)));

It throw invalidCastException at runtime,

Is it neccecery to write a custom CodeDomSerializer to generate
something like
this.userControl11.MBound = new myMarginBound()
?


Ben
Re: Need CodeDomSerializer? Mark Olbert
5/1/2006 6:57:31 PM
Have you tried creating a TypeConverter for the class, and returning an InstanceDescriptor?

Re: Need CodeDomSerializer? Kongchau
5/3/2006 6:00:57 AM
Hi Mark,

It works, thanks a lot.

Ben
AddThis Social Bookmark Button