Results 1 to 6 of 6

Thread: read/write ini files

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982

    read/write ini files

    I want to use an ini file in my application.

    In VB6 I would use the API calls

    GetPrivateProfileString and WritePrivateProfileString. Does anyone know how to read/write ini files in .NET.

    I looked on allapi but there is no .NET equivalent.

    Does this mean there isn't one.



    Other than the registry has .NET got any new and alternative methods than using ini files.



    thanks for your patience.


    Things I do when I am bored: DotNetable

  2. #2

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    I never thought about using XML.
    I understand XML but there are so many uses.

    The example is about database locations which is exactly what I wanted to store.

    http://www.thescarms.com/dotNet/AppSettings.asp

    many thanks


    Things I do when I am bored: DotNetable

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    I used the example from TheScarms but when I run it in the IDE I get the following error
    An unhandled exception of type 'System.NotSupportedException' occurred in system.dll

    Additional information: Collection is read-only.
    Has anyone any ideas.


    Things I do when I am bored: DotNetable

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Did you use any array obj ? Can you show the code that generates the error ?

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    This is the code, more or less as it is from the site.
    VB Code:
    1. Dim a As Configuration.ConfigurationSettings
    2.         a.AppSettings.Add("PartsPath", "c:\ldraw\part")


    Things I do when I am bored: DotNetable

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