Results 1 to 5 of 5

Thread: Error Dim Reader as new system.configuration.AppSettingsReader()

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Location
    Florida
    Posts
    107

    Error Dim Reader as new system.configuration.AppSettingsReader()

    I'm trying to do a lab exercise on configuration files. I enter the following in the Form1 constructor:
    VB Code:
    1. Dim Reader As New System.Configuration.AppSettingsReader

    On compile, I get this error:
    An unhandled exception of type 'System.Configuration.ConfigurationException' occurred in system.dll

    Additional information: This is an unexpected token. The expected token is 'EQUALS'. Line 6, position 27.
    Do you know what the problem is?

    Thanks - Tom

  2. #2
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Re: Error Dim Reader as new system.configuration.AppSettingsReader()

    when do you receive the error? at complie time or when you actually run the app. if it's when you run the app start debugging and let us know or see the code that it's trying to run thats causing the error

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Location
    Florida
    Posts
    107

    Re: Error Dim Reader as new system.configuration.AppSettingsReader()

    The error occurs when I run it and it tries to execute the line
    VB Code:
    1. Dim Reader As New System.Configuration.AppSettingsReader

    The error now says
    An unhandled exception of type 'System.Configuration.ConfigurationException' occurred in system.dll

    Additional information: Unrecognized configuration section appsettings
    This is done in the constructor of Form1.

  4. #4
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    Re: Error Dim Reader as new system.configuration.AppSettingsReader()

    You had mentioned how you were trying to "enter the following in the Form1 constructor". Well you dont use the Dim statement inside of constructors. Are you meaning inside of the New Sub? Or some other sub? Why don't you post the full code you have for that method, event, or sub...
    Last edited by gigemboy; Apr 25th, 2006 at 01:39 PM.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Location
    Florida
    Posts
    107

    Re: Error Dim Reader as new system.configuration.AppSettingsReader()

    VB Code:
    1. Public Class Form1
    2.     Inherits System.Windows.Forms.Form
    3.  
    4. #Region " Windows Form Designer generated code "
    5.  
    6.     Public Sub New()
    7.         MyBase.New()
    8.  
    9.         Dim Reader As New System.Configuration.AppSettingsReader
    10.  
    11.         Threading.Thread.CurrentThread.CurrentCulture = New _
    12.           Globalization.CultureInfo(CType(Reader.GetValue("Culture", _
    13.           GetType(String)), String))
    14.         Threading.Thread.CurrentThread.CurrentUICulture = New _
    15.           Globalization.CultureInfo(CType(Reader.GetValue("UICulture", _
    16.           GetType(String)), String))
    17.  
    18.         'This call is required by the Windows Form Designer.
    19.         InitializeComponent()
    20.  
    21.         'Add any initialization after the InitializeComponent() call
    22.  
    23.  
    24.     End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width