|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Application settingsHi
For my db app, I need to save the location of the db (really a windows path) which normally only needs to be set at the first app start (I can check if the setting is missing and ask user for a value). Occasionally (once in a blue moon) I may need to change this setting in case db is moved to a different server etc. My question is what sort of mechanism can/should I use to store this setting? Thanks Regards A simple way to do that is using My.Settings ...
Go to Project > Properties ... > Settings and add a setting name (i.e. = db_path and set a Type for it) Then, in your application, u can read it and write it using: Read: Msgbox ( My.Settings.db_path.ToString ) Write: My.Settings.db_path =3D "anything" -- = Tiago Salgado Blog: http://weblogs.pontonetpt.com/tiagosalgado On Sat, 19 Aug 2006 13:51:24 +0100, John <John@nospam.infovis.co.uk> wro= te: Show quoteHide quote > Hi > > For my db app, I need to save the location of the db (really a windows= = > path) > which normally only needs to be set at the first app start (I can chec= k = > if > the setting is missing and ask user for a value). Occasionally (once i= n a > blue moon) I may need to change this setting in case db is moved to a > different server etc. > > My question is what sort of mechanism can/should I use to store this > setting? > > Thanks > > Regards > > "Tiago Salgado" <tiagosalgado.develo***@gmail.com> schrieb: ACK, but note that application-scoped settings cannot be changed using >A simple way to do that is using My.Settings ... > >Go to Project > Properties ... > Settings and add a setting name (i.e. >db_path and set a Type for it) > >Then, in your application, u can read it and write it using: > >Read: Msgbox ( My.Settings.db_path.ToString ) > >Write: My.Settings.db_path = "anything" 'My.Settings'. Typically the user running the application doesn't have rights to manipulate the contents of the program files folder. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> On 19/08/2006 John wrote:
>Hi If you have users without admin rights you're down to the registry or an > >For my db app, I need to save the location of the db (really a windows >path) which normally only needs to be set at the first app start (I can >check if the setting is missing and ask user for a value). Occasionally >(once in a blue moon) I may need to change this setting in case db is >moved to a different server etc. > >My question is what sort of mechanism can/should I use to store this >setting? XML/ini file somewhere in the user's 'My Documents' folder. -- Jeff Gaines |
|||||||||||||||||||||||