Obsolete function

J

John

Hi

When using 'ConfigurationSettings.AppSettings.Get' I get the below warning.
What is the problem and how can I fix it?

Thanks

Regards

= Warning Message ============================

Warning 9 'Public Shared ReadOnly Property AppSettings() As
System.Collections.Specialized.NameValueCollection' is obsolete: 'This
method is obsolete, it has been replaced by
System.Configuration!System.Configuration.ConfigurationManager.AppSettings'
 
T

Tom Shelton

Hi

When using 'ConfigurationSettings.AppSettings.Get' I get the below warning.
What is the problem and how can I fix it?

Thanks

Regards

= Warning Message ============================

Warning 9 'Public Shared ReadOnly Property AppSettings() As
System.Collections.Specialized.NameValueCollection' is obsolete: 'This
method is obsolete, it has been replaced by
System.Configuration!System.Configuration.ConfigurationManager.AppSettings'

They have changed (much improved) the configuration management api's
in .NET 2.0. This is telling you that you may want to switch to the
new api's. You do this by adding a reference to
System.Configuration.dll, and then you can access your appsettings
section via ConfigurationManager.AppSettings.

Also, you may want to check out the My namespace stuff in VB2005 - it
has a lot of support for settings.
 
J

John

Hi

There is no dll under System.Configuration. Also System.Configuration is
already imported. Using ConfigurationManager.AppSettings.Get(key) instead of
ConfigurationSettings.AppSettings.Get(key) gives the error
'ConfigurationManager' is not declared.

Thanks

Regards
 
G

Guest

John,

Try changing it to this:

System.Configuration.ConfigurationManager.AppSettings

Ed

John said:
Hi

There is no dll under System.Configuration. Also System.Configuration is
already imported. Using ConfigurationManager.AppSettings.Get(key) instead of
ConfigurationSettings.AppSettings.Get(key) gives the error
'ConfigurationManager' is not declared.

Thanks

Regards
 
J

John

Using System.Configuration.ConfigurationManager.AppSettings.Get(key) gives
the error 'ConfigurationManager' is not a member of 'Configuration'.

Many Thanks

Regards


EdB said:
John,

Try changing it to this:

System.Configuration.ConfigurationManager.AppSettings

Ed
 
T

Tom Shelton

Hi

There is no dll under System.Configuration. Also System.Configuration is
already imported. Using ConfigurationManager.AppSettings.Get(key) instead of
ConfigurationSettings.AppSettings.Get(key) gives the error
'ConfigurationManager' is not declared.

Thanks

Regards







- Show quoted text -

System.Configuration.dll - go and add it to your project references.
System.Configuration.ConfigurationManager lives in that dll. VB2005 -
may very well add it automatically, because of the new my
functionality. I can assure you that in .net 2.0 there most certainly
is a system.configuration.dll - i work in C#, and it does not import
it by default.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top