'SomeValue' is not a member of 'MySettings'

M

Monty

[VS2005, VB.Net, ASP.Net, XP SP2]

Hello, I have a class that exposes several values like so:

Public Shared ConnString As String

The class, originally enough, is named "Settings". If I interrogate a value
of this object in the immediate window, I get the following exchange:

?Settings.ConnString
'ConnString' is not a member of 'MySettings'.

I'm not sure why it thinks I'm trying to access "MySettings". Also, when
typing the first line (above) into the immediate window, I get the correct
intellisense for my settings object. So what's the deal with "MySettings"?
TIA.
 
W

Walter Wang [MSFT]

Hi Monty,

Based on my understanding, you probably are using Web Application Project
mode instead of the Web Site mode and created Application Settings in your
project, the Settings Designer will generate a property named Settings in a
module, the Settings property is a singleton that returns a type of
My.MySettings that generated from your settings. For example:

Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty


<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As
Global.WebApplication1.My.MySettings
Get
Return Global.WebApplication1.My.MySettings.Default
End Get
End Property
End Module
End Namespace


It's recommended to avoid use Settings as your class name.


References:

#Application Settings in VB.NET 2005
http://visualbasic.about.com/od/usingvbnet/a/appsettings_4.htm


#Using My.Settings in Visual Basic 2005
http://msdn2.microsoft.com/en-us/library/ms379611(vs.80).aspx


Hope this helps.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top