VB.Net - how to use app.config and exe.config files to store values

I need my application to read this file to gather a web service URL value.

This way, I can deploy my application and edit the config file on their system to point to their local web service path and my program needs to read this value when declaring the web service path.

I have this code so far:

Imports System.Configuration
Private ws As New localhost.IDataCollectionservice()

ws.Url = ConfigurationSettings.AppSettings("CS_Time_Entry_localhost_IDataCollectionservice")

I get an error on the line above about it being obsolete??

I have CS_Time_Entry_localhost_IDataCollectionservice set up on my Settings tab in My Project and have confirmed my app.config file and exe.config file contain this value.

I've been told if I'm in Debug mode, my code will read the app.config file and if in Release mode, it will read the exe.config file.

How do I read these value from the app.config and exe.config files?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wayne Taylor (webtubbs)Commented:
You can access the settings value by using this....

    ws.Url = My.Settings.CS_Time_Entry_localhost_IDataCollectionservice


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JMO9966Author Commented:

Is it correct that this line would read from the app.config file if I'm in debug mode and exe.config if I'm in Releae mode?

I'll give that a try.
Wayne Taylor (webtubbs)Commented:
Since VB 2005, there has not been the need to worry about the app.config or app.exe.config files, as it is all handled in the Setting tab in the project properties.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.