PropertyStore does not contain a definition for Settings

G

Guest

I have a Windows.Forms application in .Net 2.0 that has a Settings class. In
the main form, I can access the setting named LastAttributeList like this:

Properties.Settings.Default.LastAttributeList

In another form in the same application, when I try to access that same
setting, the value is null. Stepping through the code and then trying to
access the LastAttributeList setting in the immediate window returns this
message:

'System.Windows.Forms.PropertyStore' does not contain a definition for
'Settings'

I can work around my problem by setting a value in the second form before
calling the form's ShowDialog() method but I would like to resolve why I
cannot access the Settings.Default instance in my second form.

Any suggestions?

Thanks,

Dale
 
L

Linda Liu [MSFT]

Hi Dale,

Based on my understanding, you have a application setting in a WinForm
application and you can access the setting in the main form using the
statement 'Properites.Settings.Default.LastAttributeList'. The problem is
that you couldn't access the same setting using the same code in another
form within the same project. If I'm off base, please feel free to let me
know.

I performed a test on this issue, but didn't reproduce the problem on my
part.

The only possible reason I could image is that the form in which you
couldn't access the setting has a different namespace from that of the main
form. But since your application has passed the compilation, it shouldn't
be the case.

If possible, could you please send me a sample project that could just
reproduce the problem? To get my actual email address, remove 'online' from
my displayed email address.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Joined
Aug 7, 2019
Messages
1
Reaction score
0
I have a Windows.Forms application in .Net 2.0 that has a Settings class. In
the main form, I can access the setting named LastAttributeList like this:

Properties.Settings.Default.LastAttributeList

In another form in the same application, when I try to access that same
setting, the value is null. Stepping through the code and then trying to
access the LastAttributeList setting in the immediate window returns this
message:

'System.Windows.Forms.PropertyStore' does not contain a definition for
'Settings'

I can work around my problem by setting a value in the second form before
calling the form's ShowDialog() method but I would like to resolve why I
cannot access the Settings.Default instance in my second form.

Any suggestions?

Thanks,

Dale
Use full-path of the Properties (i.e, NameSpace.Properties.Settings...). If there's a white-space in your name space visual studio replaces it with an 'underscore'. While intellicense recognizes your namespace with underscore, during run-time visual studio looks for the one with white-space. hence, it cannot find the Properties.Settings.
 

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