How do i Change Application Settings file location

I am making an application that runs on a usb

how can i change the application settings to

application.startuppath

(Since USB Drives can have diff drive letters)

Also How can i change the windowsxp visual style by the press of a button (xp defualts + other's) i have the user browse for the VS on their usb and they press apply and it does it. Same thing for wallpaper

thanx




Answer this question

How do i Change Application Settings file location

  • manoj mishra

    The configuration API is pluggable, and you can write your own settings provider that reads/writes the settings from wherever you want it to. You can find an example that reads/writes to the registry here: http://msdn2.microsoft.com/library/ms181001(en-us,vs.80).aspx 

    You should be able to tweak this to read/write from your usb stick.

    Best regards,
    Johan Stenberg

     



  • Evan Tupper

    Your best bet is to write your own configuration settings file that you read at startup, if you want functionality beyond what is offered.

    Remember, if the changed it to make it more versatile, it then becomes more complicated to use and thus more difficult to learn, which means you need a help file and/or a manual - which none reads .



  • chill_pill

    My program is made to run on a usb stick, it is a portable app.

    How can i change the application settings file to the application.startupdirectory

    I know it stores the settings in username\local settings\company\product\version\user.config

     

    I want the settings file on the app startup directory.

    They really need 2 change this so you can pick location 



  • bollwerj

    i have tried that and it somewhat works, although 1 form displays at a time

    forms:

    setup - writes only

    passreset - reads only

    passreset2 - writes only

    login -  reads and writes

    main - reads only (reads settings used in conjunction with settings panel)

    settings panel (lots of settings) - reads and writes

    I have tried to do my own, and it somewhat worked however i think i just overwritten the whole file, not just that value of the setting.

    I open it and each form (it is mostly 1 form at a time showing) read it and close it when i need 2 save settings i open it, write to it, and save it. Then i open it again.

    I am not really a a beginner i just never needed this type of thing before.

    I can post the code if you need me 2.



  • Sean Alford

    What I mean by write your own, is to create your own settings file (from scratch), as an XML file, INI File, plain text file, or whatever.

    Then you can do absolutely anything and store anything you like.

    For example, VB6 had GetSetting and SaveSetting - or something like that, which you could use to store settings to thje registry: but it was fixed. Consequently, very few people used it: they wrote their own classes to save their application settings to an INI file using Win32 API Calls.

    .NET has the ability to 'save' a class as an XML File. Put all your application settings in the class then save and load the class settings to whatever location you need, containing whatever data you need.

    Once you have full control over that file you can, for example, have the settings stored on the USB Key (along with the app), or have the ability to store 'mobile' settings: if they are plugged into a specific computer use a different set of settings. It also makes it easier to backup their settings file.



  • How do i Change Application Settings file location