CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Properties File

  1. #1
    Join Date
    Oct 2009

    Properties File

    Working on creating a program that dynamically changes based on a properties file. I already did this in my first of the program but I am looking for a better method to read a properties file, sort out the configuration, etc, etc.

    My current method goes like this

                string[] configProp = File.ReadAllLines(@"properties.file");
                string test1 = configProp[0];
                string test2 = configProp[1];
                string test 4 = test1.Remove(0, 11);
                string test 5 = test2.Remove(0, 16);
    I read the file into a string array. Then reassign each array to another string, and then proceed to chop it up. This works but its a lot of work, I cant change the properties file layout without moving and rearranging code. Also, verifying no mistakes are in the properties file is something I don't even know how to implement.

    Does anyone have any examples of loading a properties file or config file and doing some basic validation?
    Last edited by dunezone; January 18th, 2010 at 01:04 PM.

  2. #2
    Join Date
    Oct 2008
    Cologne, Germany

    Re: Properties File

    have you tried it with XML?
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  3. #3
    Join Date
    Oct 2009

    Re: Properties File

    Now I feel like an idiot. My last program loaded XML but I did nothing with it really. I think that would be the best solution for this.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)