Solved

XML Version of INI File

Posted on 2006-11-18
3
223 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 70

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

740 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