Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net ConfigurationManager not declared

Hi. In my VB.net Excel Add-in I get the error ConfigurationManager is not declared
I tried using Imports.System.Configuration.ConfigurationManager but that didn't help

         Dim sSQL As String = "Select * From Goals"
            Dim cs As String = ConfigurationManager.ConnectionStrings("task_conn").ConnectionString
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

I still get errors. If I declare  constring as string I get the error  "'ConfigurationManager' is not declared"

User generated image
Did you try adding the reference as I suggested before?
>I get the error  "'ConfigurationManager' is not declared"

Are you sure the error says ConfigurationManager is not declared?

It looks like the error is saying ConnectionStringSettingsCollection is not defined.
Adding a reference to System.Configuration did the trick
I thought that using Imports System.Configuration would be enough
but it seems that I needed to do both.
I always assumed that if you use Imports you don't have to add a reference.

Thanks for the help