config file - How to ?

J

John Devlon

Hi,

I would like to create a config file to store some basic user data like
default path, and some other options ...

Does anyone know which is the best solution ? Using an xml-file ? Or using a
basic txt-file ? Or are there other solutions to remember user settings ?

thanx

John
 
G

Greg

John Devlon said:
Hi,

I would like to create a config file to store some basic user data like
default path, and some other options ...

Does anyone know which is the best solution ? Using an xml-file ? Or using
a basic txt-file ? Or are there other solutions to remember user settings
?

thanx

John

Yep. Use Application Settings. Choose Settings from your Project's
Properties. Select User for the Scope. All your User preferences can be
added here. You can even update them via code etc.

Cheers.
 
N

Noone

I am not saying this is the best solution but I am using the registry
to store the info. It is actually pretty easy and you don't have to
worry about having a seperate config file around.

Just a possibility. : )

-Josh
 
J

John Devlon

Hi Greg,

Thanx for the great advice...

Do you know where I can find a good manuel on the web on how to read and
write to the user preferences ?

Many Thanx

John
 
G

Greg

John Devlon said:
Hi Greg,

Thanx for the great advice...

Do you know where I can find a good manuel on the web on how to read and
write to the user preferences ?

Many Thanx

John

It's very basic. Add in your user preferences (I change their Roaming
property from False to True).

To read a value: eg,
sAppVers = My.Settings.AppVers
sDatabaseDir = My.Settings.DatabaseDirectory
sInputDir = My.Settings.InputDirectory

To save a new value: eg,
My.Settings.AppVers = "1.1"
My.Settings.DBName = "northwind.mdb"
My.Settings.Save()

Very easy. Cheers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top