msah
msah

Reputation: 23

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?

Upvotes: 2

Views: 1512

Answers (2)

Dennis Garavsky
Dennis Garavsky

Reputation: 538

If you are developing using DevExpress XAF, you can display a standard Windows form just before the application startup. Technically, this form can be invoked via the ShowDialog method before the winApplication.Setup() call in the Main routine (of course, the invocation must be done only if no user settings are saved yet). Once you display this dialog and gather user input, update the winApplication.ConnectionString property accordingly (see also). Another more complex solution is to embed this database settings UI into the logon form as described at https://www.devexpress.com/Support/Center/Example/Details/E1344. Do not hesitate to contact the DevExpress support team if you want to further discuss the implementation of this task.

Upvotes: 0

Shell
Shell

Reputation: 6849

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/

Upvotes: 1

Related Questions