Solved

XML Version of INI File

Posted on 2006-11-18
3
218 Views
Last Modified: 2010-04-23
Hi All,

I require an XML version "ini" file...

Does someone have some code in which I can handle the same sort of functions that the old ini files used....such as add and delete section, key and value.

I am trying to stay away from the good old ini files and new to .Net and XML so bear with me.

Thanks
0
Comment
Question by:nzfire
3 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 17971491
Hi nzfire,

see an article I wrote in May 2003 from http://emoreau.s2i.com/

Cheers!
0
 
LVL 5

Expert Comment

by:DEEPESH
ID: 17971595
i think you should use config file if possible.

As it is quite easy to read and write app file through system.configuration. Just make application section in your config file
foor example
    <appSettings>
        <add key="a" value="a" />
        <add key="b" value="b" />
        <add key="c" value="cd" />
    </appSettings>



For reading
        Dim config As System.Configuration.Configuration
        config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
        Dim value As String
        value = ConfigurationManager.AppSettings(TextBox1.Text)
        MsgBox(value)

For writing
        Dim config As System.Configuration.Configuration
        config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)

        '// Add an Application Setting.
        config.AppSettings.Settings.Remove(TextBox1.Text)
        config.AppSettings.Settings.Add(TextBox1.Text, TextBox2.Text)

        '// Save the changes in App.config file.
        config.Save(ConfigurationSaveMode.Modified, True)
        config.SaveAs("C:\Documents and Settings\Administrator\Desktop\DOTNETAPP\WriteConfig\WriteConfig\app.config", ConfigurationSaveMode.Minimal, True)
        '// Force a reload of a changed section.  
        ConfigurationManager.RefreshSection("appSettings")
0
 
LVL 13

Expert Comment

by:newyuppie
ID: 17972941
if you are looking into which methods to use to create sections and read values from XML files, i recommend you browse the MSDN and look for XPathNavigator and XMLDocument.
NY
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now