Skip to content

Problem with Properties.Settings.Default to access settings in C# windows application

red man

Asked Feb 5, 2007, 10:22 AM EST2 answers
Share
LinkedInX
hi , i have C# windows app on Visual studio 2005 team system I have a connection string stored as application setting in Settings.settings file and i am trying to access it using Properties.Settings.Default but Properties keyword itself is not being recognized and i am getting a debug error Error :: The type or namespace name 'Properties' could not be found (are you missing a using directive or an assembly reference?) Any help is appreciated Yojimbo

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    1. Verify the namespace in Settings.cs. Say for example, if it is MyProject.Utilities, import this namespace where you are using. For example, if you are trying to get connectionstring in DataAccess.cs, then use "using MyProject.Utilities" in the top

    2. You can get the connectionstring by the following code
    Settings.Default. <name of your key>

    note: you don't have to say Properties.Settings.Default

    does this help? I had the same problem before but once I resolved namespaces conflict, everything started working. good luck

    0
  • 1 short reply
    • 0
      Thanks a lot
      0