| You are here: | About>Computing & Technology>Visual Basic> Using VB.NET> Coding an XML Configuration File |
![]() | Visual Basic |
Coding an XML Configuration FileThe code . . .In my opinion, however, if you want your program to be as easy to understand as possible, and you want the data itself to be easy-to-read text too, then creating a configuration file using XML methods is probably the way to go. Most modern programming technologies now completely support XML and you can open an XML file in either Notepad or most browsers to see what's in it. Writing the file directly with XML methods in VB.NET makes what is happening as clear as possible in the program code. The alternative of "serializing" to an XML file does a lot of the work for you but also makes the creation of the XML a "black box". The example you will see here puts it all out there in the open. As an example of an alternative, here's a program designed to be used as a desktop utility for simple calculations of stock market prices and amounts. The starting values are set using an XML configuration file. The starting values that will be used the next time the program is loaded can be set using an update routine that overwrites the XML file with new values. The illustration below shows the XML file displayed in IE. (IE is one of the best XML utilities!) -------- The first task for the program is to write the XML file. The code that writes the XML file is shown below. Dim Doc As New XmlDocument The explanation of the code - and the download link - for the program is on the next page. |
Las Vegas on a BudgetFind a BargainHotel DealsCheap EatsFree AttractionsEntertainment for Less |
All Topics | Email Article | | | ![]() |
| Advertising Info | News & Events | Work at About | SiteMap | Reprints | Help | Our Story | Be a Guide |
| User Agreement | Ethics Policy | Patent Info. | Privacy Policy | ©2008 About, Inc., A part of The New York Times Company. All rights reserved. |


