Application settings

  • Thread starter Thread starter John
  • Start date Start date
J

John

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 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 = "anything"
 
Tiago Salgado said:
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"

ACK, but note that application-scoped settings cannot be changed using
'My.Settings'. Typically the user running the application doesn't have
rights to manipulate the contents of the program files folder.
 
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
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?


If you have users without admin rights you're down to the registry or an
XML/ini file somewhere in the user's 'My Documents' folder.
 
Back
Top