views:

19

answers:

1

I have added a settings file to a project but whenever I reference one of the setting variables I get the following error:

Error   2   Reference to a non-shared member requires an object reference.  C:\Development\PhoenixApp\Process\CreditCardProcessing.vb   67  77  Process

I had to manually add this in a merge conflict and the settings code worked fine in the originating branch. The generated code also seems to be identical from what I can see.

I am accessing the settings using My.Settings.{VarName}

edit: Just tried deleting the settings files. This still happens once the file has been re-generated from the app.config values.

A: 

I'm not sure why this happens.

But if you go to the definition of My.Settings that property should return a reference to a Shared ReadOnly Property called [Default] in Settings.Designer.vb and that property returns the Shared member called defaultInstance.

I'd suggest trying to go back to the definitions in your code (right click on My.Settings and select Go To Definition) and make sure that it's the same for you.

ho1
The property is as follows: Public Shared ReadOnly Property [Default]() As Get Return defaultInstance End Get End Property
themaninthesuitcase
@themainin: Looks ok. I suggest editing your question to add a minimal code sample showing the bits of code where it's failing.
ho1