Using Application.Settings at run time

  • Thread starter Thread starter autenzio
  • Start date Start date
A

autenzio

I want to be able to load up the items collection of a combobox with
string values I create in Application settings. I have created a
collection of strings in the Settings window, but I am unable to bind
it to the "items" member of a combobox because that member is not
available in ApplicationSettings of the properties window. I thought it
should be easy to bind the combo box at run time, but I can't seem to
find any way to do this.

Am I going about this the right way? What my goal here is, is to be
able to use this like I used the app.config file "back in the day" to
be able to seperate settings that can change over time from the code.
This way, I can simply edit an XML file to change values rather than
needing to recompile and re-distribute the entire application.

Thanks for any help,

Arthur Autenzio ([email protected])
 
Hi,


I want to be able to load up the items collection of a combobox with
string values I create in Application settings. I have created a
collection of strings in the Settings window, but I am unable to bind
it to the "items" member of a combobox because that member is not
available in ApplicationSettings of the properties window. I thought it
should be easy to bind the combo box at run time, but I can't seem to
find any way to do this.

you should be able to bind it to AppSettings liek this:

foreach( string _value in ConfigurationSettings.AppSettings )

you could not decide which are from the particular key that you want though.
Am I going about this the right way? What my goal here is, is to be
able to use this like I used the app.config file "back in the day" to
be able to seperate settings that can change over time from the code.

This is the way to go right now too
This way, I can simply edit an XML file to change values rather than
needing to recompile and re-distribute the entire application.

But why you want to bind it to a combobox in the first place?
remember htat the config file cannot be changed in the code.
 
Thanks for the reply Ignacio, but this didn't help. I can't believe
that something as basic as this is so difficult to figure out!!

What I eventually figured out is that once you create a settings object
that contains some application settings, you can access their values at
runtime like this - namespce.Settings1.Default."setting name"

Microsoft - you should be ashamed for your lame documentation! Thanks
for changing the way one can use an app.config file and leaving it up
to us to figure out the new method.
 

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