Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Using app.config

Using app.config

Scheduled Pinned Locked Moved Visual Basic
tutorialcsharphelpquestion
7 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Codemonkey85
    wrote on last edited by
    #1

    I've seen this mentioned before, and I know how to create the app.config file in my project, and I know theoretically how to read from it, but it never works for me. So, I was wondering if someone could give me a simple example of, say, the following: Create an application (using Visual Basic.Net Home Edition) that will remember the form's Opacity, Backcolor, size and position using a configuration file (app.config). I figure if I see the code for that, I'll be able to figure out how to use the app.config file to remember other stuff too. I know it can't be that hard, because lots of people seem to use it all of the time. Thanks for the help. As I sit here, I contemplate the last words of Socrates: "I drank what?".

    C A 2 Replies Last reply
    0
    • C Codemonkey85

      I've seen this mentioned before, and I know how to create the app.config file in my project, and I know theoretically how to read from it, but it never works for me. So, I was wondering if someone could give me a simple example of, say, the following: Create an application (using Visual Basic.Net Home Edition) that will remember the form's Opacity, Backcolor, size and position using a configuration file (app.config). I figure if I see the code for that, I'll be able to figure out how to use the app.config file to remember other stuff too. I know it can't be that hard, because lots of people seem to use it all of the time. Thanks for the help. As I sit here, I contemplate the last words of Socrates: "I drank what?".

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      As you probably know, the app.config file is read by the framework and accessed through the ConfigurationSettings.AppSettings[^] collection. However this is a one-way communication, Reading only. The app.config AFAIK is only designed for external settings to be created for an application, and not for the application to write to.


      "You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar Coming soon: The Second EuroCPian Event[^].

      C 1 Reply Last reply
      0
      • C Colin Angus Mackay

        As you probably know, the app.config file is read by the framework and accessed through the ConfigurationSettings.AppSettings[^] collection. However this is a one-way communication, Reading only. The app.config AFAIK is only designed for external settings to be created for an application, and not for the application to write to.


        "You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar Coming soon: The Second EuroCPian Event[^].

        C Offline
        C Offline
        Codemonkey85
        wrote on last edited by
        #3

        Herm... that's not good. So, should I just stick with my original idea and write a text file? That's gonna be a pain... anyway, thanks for the help. As I sit here, I contemplate the last words of Socrates: "I drank what?".

        S 1 Reply Last reply
        0
        • C Codemonkey85

          Herm... that's not good. So, should I just stick with my original idea and write a text file? That's gonna be a pain... anyway, thanks for the help. As I sit here, I contemplate the last words of Socrates: "I drank what?".

          S Offline
          S Offline
          Steven Campbell
          wrote on last edited by
          #4

          Settings are very easy to save in .NET, because you can serialize objects. This makes it almost trivial to create a class to represent your settings, and then use serialization to save and load it to/from disk. See Serialization, Basic Serialization in the .NET SDK docs. There are other ways, but that is my favourite.

          T 1 Reply Last reply
          0
          • S Steven Campbell

            Settings are very easy to save in .NET, because you can serialize objects. This makes it almost trivial to create a class to represent your settings, and then use serialization to save and load it to/from disk. See Serialization, Basic Serialization in the .NET SDK docs. There are other ways, but that is my favourite.

            T Offline
            T Offline
            T Manjaly
            wrote on last edited by
            #5

            app.config is a read only mechanism. I have written a simple custom class to save/retrieve application data using hashtable and isolated storage. See if this helps : http://www.dotnetspider.com/Technology/KBPages/344.aspx :zzz:----------------------------------------------------------------------:(( T Manjaly C# Tutorials and samples : http://www.dotnetspider.com

            1 Reply Last reply
            0
            • C Codemonkey85

              I've seen this mentioned before, and I know how to create the app.config file in my project, and I know theoretically how to read from it, but it never works for me. So, I was wondering if someone could give me a simple example of, say, the following: Create an application (using Visual Basic.Net Home Edition) that will remember the form's Opacity, Backcolor, size and position using a configuration file (app.config). I figure if I see the code for that, I'll be able to figure out how to use the app.config file to remember other stuff too. I know it can't be that hard, because lots of people seem to use it all of the time. Thanks for the help. As I sit here, I contemplate the last words of Socrates: "I drank what?".

              A Offline
              A Offline
              Anonymous
              wrote on last edited by
              #6

              fjhfghfghfgh

              N 1 Reply Last reply
              0
              • A Anonymous

                fjhfghfghfgh

                N Offline
                N Offline
                Nadroj
                wrote on last edited by
                #7

                i tried that but it gave me some weird error. ------------------------ Jordan. III

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups