Solved

XML Version of INI File

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

840 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