Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB.net ConfigurationManager not declared

Posted on 2013-01-10
6
Medium Priority
?
1,888 Views
Last Modified: 2013-01-12
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
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 1000 total points
ID: 38762317
just add Imports System.Configuration

and i your code reference the connectionString property by:

        Dim constring As ConnectionStringSettingsCollection = ConfigurationManager.ConnectionStrings
0
 
LVL 13

Assisted Solution

by:LIONKING
LIONKING earned 1000 total points
ID: 38762808
You can add a reference to System.Configuration, that does the trick for me all the time.
0
 

Author Comment

by:Murray Brown
ID: 38769581
I still get errors. If I declare  constring as string I get the error  "'ConfigurationManager' is not declared"

1
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 13

Expert Comment

by:LIONKING
ID: 38769945
Did you try adding the reference as I suggested before?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38770140
>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.
0
 

Author Closing Comment

by:Murray Brown
ID: 38770266
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
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question