Solved

XML Version of INI File

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

757 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

23 Experts available now in Live!

Get 1:1 Help Now