Results 1 to 4 of 4

Thread: [RESOLVED] XML settings and data

  1. #1

    Thread Starter
    Fanatic Member Lasering's Avatar
    Join Date
    May 2006
    Location
    Lisboa
    Posts
    559

    Resolved [RESOLVED] XML settings and data

    Hi!

    In your opinion what's the best way to write and read to a XML file if you want to insert random data to the file, like settings, and later on change, add or delete some of that data?

    By best way I mean simple and few lines of code.
    Controls: XPCC|Quantum
    Windows API'sLINQ to XML SamplesRegex Tutorial

    Albert Einstein:
    "Imagination is more important than knowledge."
    "Everything should be made as simple as possible, but not simpler."
    "Great spirits have often encountered violent opposition from weak minds."

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: XML settings and data

    For settings, I go with My.Settings ... it doesn't get much simpler than that.

    Or, if you need something a bit more flexible but simple... store everythign in a class and (de)serialize it... only takes a couple lines of code, and once you make a method out of it, it's just as easy to use as My.Settings.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Fanatic Member Lasering's Avatar
    Join Date
    May 2006
    Location
    Lisboa
    Posts
    559

    Re: XML settings and data

    My.Settings is very nice, but doesn't allow to add new settings in runtime.

    Serializing/deserializing a class is very limited. If I want to serialize two different classes to the same XML I would need some kind of a workarround, like putting the 2 classes in another class. Well you see how messy that gets.

    Isn't there anyway neater?
    Controls: XPCC|Quantum
    Windows API'sLINQ to XML SamplesRegex Tutorial

    Albert Einstein:
    "Imagination is more important than knowledge."
    "Everything should be made as simple as possible, but not simpler."
    "Great spirits have often encountered violent opposition from weak minds."

  4. #4

    Thread Starter
    Fanatic Member Lasering's Avatar
    Join Date
    May 2006
    Location
    Lisboa
    Posts
    559

    Re: XML settings and data

    Found the solution here. LINQ to XML is very neat and easy to use.
    Controls: XPCC|Quantum
    Windows API'sLINQ to XML SamplesRegex Tutorial

    Albert Einstein:
    "Imagination is more important than knowledge."
    "Everything should be made as simple as possible, but not simpler."
    "Great spirits have often encountered violent opposition from weak minds."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width