Solved

VB.net ConfigurationManager not declared

Posted on 2013-01-10
6
1,734 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
[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:
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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get month and date in a format 4 52
ModalPopup  question 22 56
VB.net Excel VSTO Add-in version compatability 2 36
SSIS - Using VB.NET to parse XML file 11 40
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 …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 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