INI File

I have some read only textboxes
I want to store the content of these textboxes in an INI file.. so that they persist when loaded again.. .. but I want to prevent user from opening the file in a text editor and looking / changing the contents of the file

Can any one suggest how to create a binary INI file and manipulate its content

TIA



Answer this question

INI File

  • Vista

    For handling INI files there is a good artikel on The Code Project:
    http://www.codeproject.com/csharp/kratinihandler.asp

    But in .NET we have XML, use the ConfigurationManager class:


    // Create a custom section.
    static UsingConfigurationManager()
    {
        // Get the application configuration file.
        System.Configuration.Configuration config =
                ConfigurationManager.OpenExeConfiguration(
                ConfigurationUserLevel.None);
     
        // If the section does not exist in the configuration
        // file, create it and save it to the file.
        if (config.Sections[customSectionName] == null)
        {
            custSection = new CustomSection();
            config.Sections.Add(customSectionName, custSection);
            custSection =
                config.GetSection(customSectionName) as CustomSection;
            custSection.SectionInformation.ForceSave = true;
            config.Save(ConfigurationSaveMode.Full);
        }
    }
     



  • INI File