Martin KS
Martin KS

Reputation: 531

How do I store persistent user preferences in VB.net

I'm writing a relatively complex outlook add-in, and would like to have an initial setup process before storing user's choices. What's considered best practice?

Off the top of my head I could write a file somewhere, or maybe use the registry?

Upvotes: 0

Views: 105

Answers (1)

SierraOscar
SierraOscar

Reputation: 17637

Use the Project Settings and set the scope to "User"

enter image description here

So if you had a setting called "myOutputLocation" you would refer it in your code like:

Dim myLoc As String = My.Settings.myOutputLocation

Similarly, you can assign persistent values back to it with:

My.Settings.myOutputLocation = someUserGeneratedString

Note that when you debug, the settings are temporary and do not write back to the actual project - but in live they will be persistent.

Upvotes: 2

Related Questions