Link to home
Start Free TrialLog in
Avatar of HLRosenberger
HLRosenbergerFlag for United States of America

asked on

How do I retrieve application settings?

How do I retrieve application settings from the app.config file?  (See below) .  This is using VS 2010, .NET 4.0  

            <setting name="ConnectionString" serializeAs="String">
                <value>Data Source=; Database=tds; User Id=sa; Password=windy;</value>
            <setting name="InputView" serializeAs="String">
            <setting name="OutputTable" serializeAs="String">
Avatar of Hawkvalley1
Flag of United States of America image

In your code:

Open in new window

Avatar of Nasir Razzaq
Use the My.Settings.Settingname

so for InputView

Avatar of HLRosenberger


My.Settings.xxxx does not work.  it does not recognize the setting name.

Did you add the settings on the Settings tab?
I added a new item, a setting file, and them I added my setting to that tab.  it created an app.config file with my settings.    

but I still cannot reference the setting in code.  I must be missing something.
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Setting tab?  I thought I have to first add a Setting item.

Do there is a default setting tab?   let me look...  How do I get to it...
That's it!   I thought I first had to add a setting item.  If I add the setting to the project/setting tab, everything is fine!