[dba-VB] VB.Net XML - store form defaults

Shamil Salakhetdinov shamil at users.mns.ru
Wed Jul 18 20:34:44 CDT 2007


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
 
-----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 7:28 PM
To: dba-vb at databaseadvisors.com
Subject: [dba-VB] VB.Net XML - store form defaults

I need a way to store the values in controls as the form closes, such that
the form can the load those last values when it re-opens.  I do things like
enter data in controls for server, database, table, paths to files etc.  I
need the form to save those values so that the next time the form opens it
can retrieve those values and I don't have to key them in again every time.

Does anyone has any code for doing that, or hotlinks to UNDERSTANDABLE (to a
nubee) web sites?

TIA,

John W. Colby
Colby Consulting
www.ColbyConsulting.com 

_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list