'System.Configuration.ConfigurationException' occurred in system.dll error in VB.NET program.

Posted on 2007-08-09
Last Modified: 2012-06-27
Hey guys it's been awhile...

Here's my question...I am getting the following error when I try to step through this VB.Net program: An unhandled exception of type 'System.Configuration.ConfigurationException' occurred in system.dll
Additional information: Only elements allowed

I know it has something to do with the XML file but I can't figure out what's wrong with the syntax. The XML file is named "App.config" and this is the rather simple code in it...

<?xml version="1.0" encoding="utf-8" ?>
      <add key ="ReconcileConnection" value="server=paragon;uid=sa;pwd=huds;database=Reconcile" />
      <add key ="EODConnection" value="server=ny-3;uid=sa;pwd=huds;database=EODSettlements" />
      <!--add key ="SladgeConnection" value="Provider=Microsoft.Jet.OLEDB.4.0;Data source=g:\database\11_16_2005\Sladge_05262006.mdb" /--> 'changed to g drive for testing purposes
      <add key ="SladgeConnection" value="Provider=Microsoft.Jet.OLEDB.4.0;Data source=C:\Chris\14810_reconcile\Sladge_05262006.mdb" />
      <add key ="FCStone_Account" value="14810" />
      <add key="FCStone_OpenPosition" value=".\Positions_14810.txt" />
      <add key="FCStone_Confirms" value="..\Confirms_14810.txt" />
      <add key="FCStone_NetLiq" value="..\NL_14810.txt" />
      <add key="FCStone_Balance" value="..\Balance_14810.txt" />

The text files in question are in the same folder as the vbproject file named "14810_reconcile". (C:\Chris\14810_reconcile)

This is the line in my VB code where it breaks.

Dim FCS_OP_File As String = System.Configuration.ConfigurationSettings.AppSettings("FCStone_OpenPosition")
    Dim FCS_Trades_File As String = System.Configuration.ConfigurationSettings.AppSettings("FCStone_Confirms")
    Dim FCS_NL_File As String = System.Configuration.ConfigurationSettings.AppSettings("FCStone_NetLiq")
    Dim FCS_Bal_File As String = System.Configuration.ConfigurationSettings.AppSettings("FCStone_Balance")
    Dim statementAcccountID As Int32 = CInt(System.Configuration.ConfigurationSettings.AppSettings("FCStone_Account"))

Can someone please assist with me with figuring this out. I've been tripped up on that first line all day!!!
Thanks in advance,
Question by:Definit1
    LVL 38

    Accepted Solution

    'changed to g drive for testing purposes   <--- This is not valid in your XML file... Delete this line and try it again.
    LVL 6

    Expert Comment

    <!--add key ="SladgeConnection" value="Provider=Microsoft.Jet.OLEDB.4.0;Data source=g:\database\11_16_2005\Sladge_05262006.mdb" /--> 'changed to g drive for testing purposes
    change to
    <!--add key ="SladgeConnection" value="Provider=Microsoft.Jet.OLEDB.4.0;Data source=g:\database\11_16_2005\Sladge_05262006.mdb" /> 'changed to g drive for testing purposes -->

    Author Comment

    Paul you are the worked!!! Of course I forgot to delete the prior "comment out" I had in the code and didn't remember to put the comment out syntax on that line. I can't believe I spent the better part of the day wrestling with this and couldn't be helped by my PHD in mathematics colleague even!
    It's good to be back...thanks again Paul!


    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

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    733 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

    22 Experts available now in Live!

    Get 1:1 Help Now