c# - How to change static variable in partial class when application settings update? -


i have modal form in users can enter database connection strings. , on main form, gets value of string has been entered on modal form.

problem is, when change setting within modal form , save it, doesn't update while program running. program has restart before changes take effect.

public partial class ebaylisting : form {     static string dbserver = properties.settings.default.dbserver;     static string dbname = properties.settings.default.dbname;     static string uname = properties.settings.default.uname;     static string pword = properties.settings.default.pword;      static string constring = "server=" + dbserver + ";" + "database=" + dbname + ";" + "uid=" + uname + ";" + "password=" + pword + ";";      mysqlconnection con = new mysqlconnection(constring);     mysqlcommand cmd;     mysqldataadapter adapter;     datatable dt = new datatable(); } 

i need static strings update each time settings change modal form.

the best way implement inotifypropertychanged , when 1 of strings changes, update appropriate part of static variable.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -