Results 1 to 3 of 3

Thread: [RESOLVED] Correct method for application settings

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2010
    Location
    Southeast Michigan
    Posts
    155

    Resolved [RESOLVED] Correct method for application settings

    Was just curious to know if there is a typical method for handling application settings. I have two types of settings; Applications settings (like user preferences) and 'system' settings (server IP, options related to the industrial machine it's running on that need to be set at startup, ports that certain devices are attached to, etc).

    I was thinking that what I'm referring to as system settings would be in a configuration.ini type of file that can easily be edited. Then save the other settings either in the registry or a separate user.cfg file that would not be edited on it's own but changed through option settings in the program itself.

    Am I over complicating this? Is it normal to use the registry to store program settings or would it be better in a file?
    Dave

    Helpful information I've found here so far : The Definitive "Passing Data Between Forms" : Restrict TextBox to only certain characters, numeric or symbolic :
    .NET Regex Syntax (scripting) : .NET Regex Language Element : .NET Regex Class : Regular-Expressions.info
    Stuff I've learned here so far : Bing and Google are your friend. Trying to help others solve their problems is a great learning experience

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Correct method for application settings

    Completely so...

    Open your project properties, go to the settings tab.... BAM! That's exactly what those are for... For scope, for your "application" settings (which are really user settings) you'll want to use the "User" scope... and for your "system" settings, use "Application" scope...

    Here's what will happen:
    an application.config file will be created. that is the design time file with the settings and the default user settings. When you run the app, it gets copied to the bin folder and renamed yourapp.exe.config. I mention this because people post "where' my config file when I run the app?"

    When you change any of the user settings, it gets saved to the USER'S PROFILE in a yourapp.user.config file. Both are in XML format, both can be easily edited, but really shouldn't be done from outside the app. Since this is built into VB, it's easy to use and setup.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2010
    Location
    Southeast Michigan
    Posts
    155

    Re: Correct method for application settings

    Embarrassing, but I didn't even know that was there.

    Just took a look and seems pretty easy to setup and use. Thanks tg!
    Dave

    Helpful information I've found here so far : The Definitive "Passing Data Between Forms" : Restrict TextBox to only certain characters, numeric or symbolic :
    .NET Regex Syntax (scripting) : .NET Regex Language Element : .NET Regex Class : Regular-Expressions.info
    Stuff I've learned here so far : Bing and Google are your friend. Trying to help others solve their problems is a great learning experience

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