Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / September 2005

Tip: Looking for answers? Try searching our database.

XML Serialization in the BasicDesignerLoader Class

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Whitchurch-Bennett - 22 Sep 2005 20:10 GMT
Firstly, I am writing my project in VB.NET in VS2005.

I am working on a custom forms designer, and am trying to save and load the
layout to an XML file.

I have overriden the PerformFlush method of the base class
BasicDesignerLoader, and want to serialize to XML. Problem is, I can't create
the XMLSerializer object because it can't perform relection on the Form type.
How can I get this serializer to work with the BasicDesignerLoader, and is
this possible at all?

Thanks,

David.
"Jeffrey Tan[MSFT]" - 23 Sep 2005 08:49 GMT
Hi David,

Thanks for your post.

Yes, this is because Form class did not have SerializableAttribute.
Actually, we have to do the Xml serialization ourselves. Microsoft has
released a KB to demonstrate a sample DesignerHost, please refer to the KB
below:
"INFO: Code Sample That Demonstrates How to Create a Custom Form Designer
by Using Visual C# .NET"
http://support.microsoft.com/default.aspx?scid=kb;en-us;813808

In this sample, the serialization code is located in SampleDesignerHost.cs
file. The key xml serialization code is SampleDesignerHost.Flush method. We
can see that it uses XmlDocument class and other xml classes to serialize
the controls/components itself. Also, it also provided another way of
serialization using Code DOM to serialize the controls/components as
C#/VB.net code file.

I think you may get a lot of useful information from this sample.

Hope this helps

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Signature

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

David Whitchurch-Bennett - 23 Sep 2005 11:04 GMT
Thanks for that information. It is very difficult for me to translate the
code into VB, but I think I see how it is done. I am also trying to learn to
deserialize CodeDOM statements into the designer, and if I can get the VB
back to CodeDom, then that will be the prefered method. Failing that, I will
look at this again, but it seems way to compicated if I can use the CodeDom.

Thanks for the pointer though, and it will certainly help!

> Hi David,
>
[quoted text clipped - 24 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.