Solved

VB.net ConfigurationManager not declared

Posted on 2013-01-10
6
1,626 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:murbro
6 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 250 total points
Comment Utility
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 250 total points
Comment Utility
You can add a reference to System.Configuration, that does the trick for me all the time.
0
 

Author Comment

by:murbro
Comment Utility
I still get errors. If I declare  constring as string I get the error  "'ConfigurationManager' is not declared"

1
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 13

Expert Comment

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

Expert Comment

by:CodeCruiser
Comment Utility
>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:murbro
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now