vb.net - SettingsPropertyNotFoundException - Trying to allow the user to add new keys and values to the config file -


i have application has configuration different companies.

looks this:

<setting name="instances" serializeas="string">     <value>2</value> </setting>  <setting name="instance_1_exportto" serializeas="string">     <value>a/gp_import/</value> </setting> <setting name="instance_1_importfrom" serializeas="string">     <value>a/gp_export/</value> </setting> <setting name="instance_1_companyid" serializeas="string">     <value>wcair</value> </setting> <setting name="instance_1_name" serializeas="string">     <value>a</value> </setting>  <setting name="instance_2_exportto" serializeas="string">     <value>import/</value> </setting> <setting name="instance_2_importfrom" serializeas="string">     <value>export/</value> </setting> <setting name="instance_2_companyid" serializeas="string">     <value>beave</value> </setting> <setting name="instance_2_name" serializeas="string">     <value>b</value> </setting> 

now if put in of that, including 1 , 2 visual studio, compile , run great.

but if user changes "instances" 3, , copies , pastes them make "instance_3_..." when application run, trys load instance_3_name , gets property not found exception...? settingspropertynotfoundexception

any help? how can tell app config file has changed? or have recompiled?

the property exist , config file loading "3" number of instances, guess cause wasnt there @ compile doesnt exist?

you need force re-read of configuration after has been modified.

see programmatically refreshing configuration sections.

if have time create custom app.config configuration section might find advantageous pursuit. also, need think how trigger refresh. user need click refresh button or plan use timer? can add file system watcher not straightforward other 2 techniques mentioned above.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -