c# - How i can save settings to the application Settings? -


i created new cell called mysettings

mysettings

the type string scope user.

and in place want store last selected path:

private void btndirectory_click(object sender, eventargs e)         {             folderbrowserdialog mydialog = new folderbrowserdialog();             mydialog.selectedpath = lbldirectoryname.text;              if (mydialog.showdialog() == dialogresult.ok)             {                 lbldirectoryname.text = mydialog.selectedpath;             }         } 

right after line

mydialog.selectedpath = lbldirectoryname.text; 

i want store mydialog.selectedpath mysettings tried type: properties.settings. have there options first default. mysettings ?

and , how load saved settings ?

 if (mydialog.showdialog() == dialogresult.ok)   {     lbldirectoryname.text = mydialog.selectedpath;     properties.settings.default.mysettings=mydialog.selectedpath;     properties.settings.default.save();   } 

you can retrieve store/saved value following:

mydialog.selectedpath=properties.settings.default.mysettings; 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -