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
Post a Comment