How to access a key field from the app.config file?

I have an App.config file with a key that points to a file path. I am not able to access the key though as the compiler does not like my syntax. See the line below I marked as line 1. Also, I did import the correctly at the top of the vb.net code page.
Imports System.Configuration

1.    Dim testString As String = ConfigurationManager.AppSettings("filepath")

from my XML file :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
  <add key="filePath" value = "c:\dropOffFolder" />
</appSettings>
LVL 2
brgdotnetcontractorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Najam UddinCommented:
include reference to System.Configuration
Dim objConfig As Configuration.ConfigurationSettings
Dim strfilePath As String = objConfig.AppSettings("filePath")

Open in new window

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
Éric MoreauSenior .Net ConsultantCommented:
brgdotnetcontractorAuthor Commented:
Eric and Najam.

Najam - I am using a Windows Forms application and when I right click on the project I don't see the option to add a reference to any dll. I can do what you are talking about using a web application, but for my windows forms project I don't see the option to add a reference to a dll.

Eric - Very impressive article. This looks like a good way to work with with the App.config file, however I want my application user to be able to manually edit App.config file, and not have to use the configuration settings editor mentioned in your article
Éric MoreauSenior .Net ConsultantCommented:
app.config was not designed to be user customizable. it is for developers to provide settings to all users.
brgdotnetcontractorAuthor Commented:
Good info. Thanks!!
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.