Search code examples
winformsdevexpressapp-configxaf

how to change settings without app.config devexpress?


I need app.config automatically database informations setting according to a user control .. Normally, we are setting up database informations in app.config. But when standart users run this program, it must login database setting on a interface . so, they should enter their database informations . not in app.config. how should I do this?


Solution

  • if you are using visual studio for Windows Form Application then you can create Settings to store your different type of values in it. You can write and read settings programmatically like this.

    //To Write
    Properties.Settings.Default.DatabaseName = textBox1.Text;
    Properties.Settings.Default.Save();
    
    //To Read
    textBox1.Text = Properties.Settings.Default.DatabaseName;
    

    You can find article about User's Settings on MSDN

    Edited Full Example given here:

    http://www.c-sharpcorner.com/UploadFile/5089e0/create-single-connection-string-for-all-windows-form-in-net/