Retrieve variable Settings values.

  • Thread starter Thread starter Bishman
  • Start date Start date
B

Bishman

Hi,

I am retrieveing Application settings using
"Properties.Settings.Default.xxxxxxxx" where xxxxxxxx is known at design
time.

How can I retrieve a 'soft' setting, ie: the value I wish to retrieve is
the prefix to a file name. I can get the prefix value from the file, but how
would I lookup the coresponding settings value, as it appears that the
settings are all set at design time. I will need to change the prefix of the
files, and so would like to change the prefix value that is being looked up
in the settings file.

Any ideas please ?

Thanks.
 
I'm not 100% clear from the question, but do you just mean this?

string settingName = "SomeRandomStringSetAtRuntime";
Properties.Settings.Default[settingName]

??

Marc
 
Thanks, thats sorted it.

Obvious but I didnt click that the Settings are in an array ! (Doh)
string sVal = "TestSetting";

string retval = (string)Properties.Settings.Default[sVal];

I can now retrieve the value I need, thanks a lot !

Jon
 

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

Back
Top