Solved

VB.net ConfigurationManager not declared

Posted on 2013-01-10
6
1,663 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
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 250 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:murbro
ID: 38769581
I still get errors. If I declare  constring as string I get the error  "'ConfigurationManager' is not declared"

1
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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:murbro
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

770 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