Charlotte Foust
cfoust at infostatsystems.com
Thu Jul 19 10:27:01 CDT 2007
The specific "how" is use the databindings properties of the form. Typed Datasets are the easiest to work with because even in design time, they know what the properties of their source is--fields, data types, etc. We normally create a class for each typed dataset, give it whatever business rules we want to enforce at the data level, and drag the class form the toolbox onto the form or user control. That creates the binding to the form and you can then control the binding to the controls in design view or through code. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Wednesday, July 18, 2007 6:58 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] VB.Net XML - store form defaults 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 _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com