jwcolby
jwcolby at colbyconsulting.com
Wed Jul 18 20:57:38 CDT 2007
Shamil, Funny you should mention that. I was working on just such a class earlier this afternoon - from a book called Beginning Visual Basic .NET from Wrox. That book does not mention binding the form to the class though. It actually reads / writes the values out of the controls. I like the "binding" idea. Now all I have to do is figure out how to do that. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Wednesday, July 18, 2007 9:35 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] VB.Net XML - store form defaults Hello John, It's rather easy on .NET (there could be dozen ways to do that) - simplest IMO and the most appropriate for you because you are a bounder and you like custom classes :) : - create custom class preferably with public setters and getters for the properties values you use; - bind your form to this custom class; - run you application and edit bound to your custom class form fields' values; - use System.Xml.Serialization.XmlSerializer and TextWriter/StreamWriter and TextReader/StreamReader to save/restore (serialize to/desterilize from) defaults to/from text(xml) file... - next time you start your app your class static method will read serialized XML, will desterilize it into class instance and will bind your form to the properties of this class instance... That's it. Should be less than 10 lines of code to serialize/desterilize defaults to/from xml file... -- Shamil