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. C#
  4. Configuration settings - Howto? [modified]

Configuration settings - Howto? [modified]

Scheduled Pinned Locked Moved C#
questionworkspace
3 Posts 3 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.
  • P Offline
    P Offline
    Phrone
    wrote on last edited by
    #1

    I'm trying to find out how the config file works. This is how my config file looks like now.

    foo The Sampletext is connected to a textbox and the default value shows. But how do I make if i want to write a new text and save it for the user, and next time I run the program the new value should show up in the textbox? I've tried with ConfigurationManager to store the new value, but I only get System.NullReferenceException so I do something wrong. -- modified at 13:11 Monday 15th October, 2007

    S J 2 Replies Last reply
    0
    • P Phrone

      I'm trying to find out how the config file works. This is how my config file looks like now.

      foo The Sampletext is connected to a textbox and the default value shows. But how do I make if i want to write a new text and save it for the user, and next time I run the program the new value should show up in the textbox? I've tried with ConfigurationManager to store the new value, but I only get System.NullReferenceException so I do something wrong. -- modified at 13:11 Monday 15th October, 2007

      S Offline
      S Offline
      Skippums
      wrote on last edited by
      #2

      See this article: http://www.codeproject.com/csharp/UserSettings.asp[^] Jeff

      1 Reply Last reply
      0
      • P Phrone

        I'm trying to find out how the config file works. This is how my config file looks like now.

        foo The Sampletext is connected to a textbox and the default value shows. But how do I make if i want to write a new text and save it for the user, and next time I run the program the new value should show up in the textbox? I've tried with ConfigurationManager to store the new value, but I only get System.NullReferenceException so I do something wrong. -- modified at 13:11 Monday 15th October, 2007

        J Offline
        J Offline
        Justin Perez
        wrote on last edited by
        #3

        Right click on your project and properties then goto settings. you can create a string there. It's a configuration property. These values are saved to your EXE' exe.config file. you can set to this string you created by doing a

        your.projects.namespace.Properties.Settings.Default.YourSettingName = m_YourVariable;

        Then to get the value of the settings you created you can do

        m_YourVariable = your.projects.namespace.Properties.Settings.Default.YourSettingName;

        I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")

        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