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 / WinForm General / June 2007

Tip: Looking for answers? Try searching our database.

Deleting and creating controls via code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John - 20 Jun 2007 18:19 GMT
Hi

Is it possible to enumerate all controls on a form and then save the info in
an xml file via code? Is it possible to reverse the process i.e. read info
from and xml and recreate all controls on a blank form? I am just trying to
find a way to cerate "templates" so users can choose which controls they
want to see and with what attributes; position, size, colour etc.

A code example would be great.

Many Thanks

Regards
Bob Powell [MVP] - 20 Jun 2007 20:25 GMT
Yeah sure, it's called XAML ;-)

But seriously...

The idea isn't new and there are several concrete ways of doing it but
there are some pitfalls.

Using the simplest method, that of XML serialisation, is impossible
without significant work because forms and other controls contain values
and objects that are themselves not serialisable.

The method best known is to use the Memento Pattern in which you create
a family of objects that are themselves perfectly serialisable and can
represent the graph of objects that you really want to save and load.

Signature

Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

> Hi
>
[quoted text clipped - 9 lines]
>
> Regards

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.