none
'Settings' is not a member of 'My'

    Question

  • Using Visual Studio 2013 under 64 bit Windows 10 Pro.

    Almost by accident (I was looking at potential ways of changing the Connection String used by some DataTables), I discovered that any attempt to do anything with My.Settings in a project I was working on failed, giving the error message in the title of this Question. I was able to find a fair number of discussions of the causes for this and similar errors in various forums, but none seemed relevant to my situation. This particular project - a quite simple one - was originally written in VS 2010 and converted to VS 2013 (which one of the discussions I read suggested might be relevant), but I have a much more complex project which started off under VS ?2007 and was subsequently converted to VS 2010, and thence to VS 2013, in which the My.Settings tree is normally accessible. After more experimentation, I found that if I created a brand new Windows Forms project and simply added a label and a listbox to the default form, an attempt to access My.Settings (from the Immediate windows) failed with the same error, so the content of the project does not seem to be relevant.

    Still using the dummy project, if I explicitly add the WPF My Extensions in the Project Properties and attempt to rebuild it, I get a number of errors complaining about a missing Reference to System.XAML, but if I add this Reference, I still have two remaining Build Errors complaining about 'Application' being ambiguous between MyProject and MyWpfExtension.

    Has anyone got any idea what is going on here?

     

    Peter R. Fletcher

    Wednesday, April 6, 2016 9:26 PM

Answers

  • Hi Peter,

    sorry that you was annoyed by that action. We moderators try to mark helpful replies that might have helped or even completly answered an question as answer because a lot of users does not do this step. So this simply "a moderator task" that was donw after some time in the hope that your problem was solved.

    What I just thought of now:

    Did you start a debug and then stopped it to use the debugger? Or did you simply open the Immediate Windows and tried to use My.Settings? That will not work, because the full name of the Namespace is Global.<Projectname>.My.

    When inside the application, you simply write "My.Settings" because you are already in the namespace Global.<Projectname> so it is a "relative" Namespace that you give in there.

    You can also check the Settings.Designer.vb file inside the My Project directory. You will find the full namespace. So in my own test project, that I created, I found:

            Friend ReadOnly Property Settings() As Global.WindowsVBApplication1.My.MySettings
                Get
                    Return Global.WindowsVBApplication1.My.MySettings.Default
                End Get
            End Property

    With kind regards,

    Konrad


    Friday, April 22, 2016 5:13 AM
    Moderator

All replies

  • Hi Peter R. Fletcher,

    >>Almost by accident (I was looking at potential ways of changing the Connection String used by some DataTables), I discovered that any attempt to do anything with My.Settings in a project I was working on failed, giving the error message in the title of this Question. 

    Actually this forum is to discuss the VS IDE, it seems that the specific issue would be related to your settings file in certain projects, am I right?

    To really repro this issue, could you share us a simple sample using one drive? So we could test it in our side.

    Please also attach your Visual Studio project, you can upload it to the one drive, and then share the download link in your post. Please also attach a screenshot image in your post.

    If there's any concern, please feel free to let me know.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 8, 2016 1:21 AM
    Moderator
  • Well, actually No, or at least I don't think so. What I am describing seems to me like a problem with the IDE. The real program in which I originally found the problem builds and runs perfectly normally. The data connections in it appear to be able to access and use their Connection Strings, and I can use autocomplete to navigate to them with a ? operator in the Immediate Window. When I press <Return> on the query line, however, I get the "'Settings' is not a member..." error, rather than the value of the Connection String.

    As I also said, I can demonstrate the problem in a trivial Project, which I have uploaded to OneDrive. Here is the link:

    https://onedrive.live.com/redir?resid=28FD7B6CC5A62146!1211&authkey=!AALQ2Z2LvsvnIcQ&ithint=folder%2csuo

    If I load this project and attempt to display any (theoretically) viewable 'leaf' of the My.Settings tree in the Immediate Window, I get the error, even though autocomplete works in that window (and elsewhere in the IDE) for the My.Settings tree.


    Peter R. Fletcher

    Friday, April 8, 2016 1:44 PM
  • You can view your settings when you open the Project Properties and then choose settings?

    Inside the project directory you have "My Project" and in there settings.settings and Settings.Designer.vb. These files are there?

    That is responsible for your My.Settings - so if you have problems maybe that is broken or lost?

    With kind regards,

    Konrad

    Friday, April 8, 2016 5:50 PM
    Moderator
  • In the small working Project in which I first noticed the problem, the list in the Settings tab in Project Properties contains the two saved Connection Strings (one old, one newer) for my data adapters. In my dummy test project, that list is empty. In both projects, the files you mention are present and (presumably, since the Projects build without errors) correct.

    Peter R. Fletcher

    Friday, April 8, 2016 6:30 PM
  • Thanks for Konrad's help

    Hi Peter R,

    What about this issue? Do you resolve this issue in your side?

    >>'Settings' is not a member of 'My'.

    It seems that Konrad's suggestion was helpful for this issue, like this case:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/976ea920-2bcd-462e-b1ff-a76e18308960/settings-is-not-a-member-of-my?forum=vbgeneral

    It would be related to the property->settings options/settings.

    >>I found that if I created a brand new Windows Forms project and simply added a label and a listbox to the default form, an attempt to access My.Settings (from the Immediate windows) failed with the same error, so the content of the project does not seem to be relevant.

    In addition, I download your sample from one drive, it was one blank winform app, but I couldn't repro your issue in my side. I could run it normally, could you share us the detailed steps about how you really repro it? Do you add two projects in the same solution except this VB winform app? Could you share us the whole sample? Please also share us a screen shot about how you access the settings in the immediate windows.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, April 11, 2016 7:49 AM
    Moderator
  • Konrad's thread was the first or second one I reviewed when I was researching this issue, but does not help.

    The Project I uploaded is the complete example Project. It is a very simple example, intended (apparently unsuccessfully!)  to minimize possible confusion. See the attached image showing my Immediate Windows query and the error message.


    Peter R. Fletcher

    Monday, April 11, 2016 1:10 PM
  • Hi Peter,

    It seems that I could debug it in my side.

    You could download the sample here:

    https://onedrive.live.com/redir?resid=55E83A59BF9AE3EB!878&authkey=!AE4woxaCWTFxe6Q&ithint=folder%2c

    I just add/generate two control's even code, and then debug the app with a breakpoint, I could get the "true" if I run it in my Immediate Windows after the breakpoint was hit. 

    Thanks,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, April 12, 2016 5:33 AM
    Moderator
  • It may well be true that in the trivial test case I supplied, adding some events makes things work properly. It should not be necessary to do this, even in the trivial test case, and it does not explain or solve the identical problem in my real Project, most of whose controls do have working events. That project depends on an external database, or I would upload it, too.

    Peter R. Fletcher

    Tuesday, April 12, 2016 3:17 PM
  • Peter,

    If you use the My class outside VB, you have to set an reference to Visual Basic. The My class was created in 2005 to make it easier for current vintage VB versions to get things done in the way they where used. 

    Most newer Visual Studio programmers including those from VB don't like it.


    Success
    Cor


    Tuesday, April 12, 2016 4:17 PM
  • I am not trying to use My outside VB. I am programming in Visual Basic. The Project references the VisualBasic Namespace, and any attempt to add a Reference to it explicitly gives an "already included" error.

    I don't normally use the My Class, either, but I was led to it while looking at accessing Connection Strings.


    Peter R. Fletcher

    Wednesday, April 13, 2016 12:36 AM
  • Using Visual Studio 2013 under 64 bit Windows 10 Pro.

    Almost by accident (I was looking at potential ways of changing the Connection String used by some DataTables), I discovered that any attempt to do anything with My.Settings in a project I was working on failed, giving the error message in the title of this Question. I was able to find a fair number of discussions of the causes for this and similar errors in various forums, but none seemed relevant to my situation. This particular project - a quite simple one - was originally written in VS 2010 and converted to VS 2013 (which one of the discussions I read suggested might be relevant), but I have a much more complex project which started off under VS ?2007 and was subsequently converted to VS 2010, and thence to VS 2013, in which the My.Settings tree is normally accessible. After more experimentation, I found that if I created a brand new Windows Forms project and simply added a label and a listbox to the default form, an attempt to access My.Settings (from the Immediate windows) failed with the same error, so the content of the project does not seem to be relevant.

    Still using the dummy project, if I explicitly add the WPF My Extensions in the Project Properties and attempt to rebuild it, I get a number of errors complaining about a missing Reference to System.XAML, but if I add this Reference, I still have two remaining Build Errors complaining about 'Application' being ambiguous between MyProject and MyWpfExtension.

    Has anyone got any idea what is going on here?

     

    Peter R. Fletcher

    My.Settings accesses previously created settings created under the application properties, settings menu in the IDE. If no settings either user or app scoped exist then there are no settings for My to access via the Settings object.

    There's numerous questions regarding issues people have had trying to use the My feature in this forum which you can search for to see if any concern your issue.

    Also see https://msdn.microsoft.com/en-us/library/saa62613.aspx - My.Settings Object.

    Have you selected the project tab (I think it is) and at the bottom the applications name properties selection? If so you can also see "References" as a selection that will let you see what ref's your app has, some by default. Unnecessary ones can be removed I believe.


    La vida loca

    Wednesday, April 13, 2016 1:03 AM
  • I have no idea why this was marked as the answer to my question, since it contains only suggestions to browse the forums, as I have indicated that I have already done, and a rather vague description of other steps that I have already said that I have taken, without useful result. Surely it should be up to the individual who asks a question to decide whether it has been answered?!!

    Peter R. Fletcher

    Friday, April 22, 2016 3:45 AM
  • Hi Peter,

    sorry that you was annoyed by that action. We moderators try to mark helpful replies that might have helped or even completly answered an question as answer because a lot of users does not do this step. So this simply "a moderator task" that was donw after some time in the hope that your problem was solved.

    What I just thought of now:

    Did you start a debug and then stopped it to use the debugger? Or did you simply open the Immediate Windows and tried to use My.Settings? That will not work, because the full name of the Namespace is Global.<Projectname>.My.

    When inside the application, you simply write "My.Settings" because you are already in the namespace Global.<Projectname> so it is a "relative" Namespace that you give in there.

    You can also check the Settings.Designer.vb file inside the My Project directory. You will find the full namespace. So in my own test project, that I created, I found:

            Friend ReadOnly Property Settings() As Global.WindowsVBApplication1.My.MySettings
                Get
                    Return Global.WindowsVBApplication1.My.MySettings.Default
                End Get
            End Property

    With kind regards,

    Konrad


    Friday, April 22, 2016 5:13 AM
    Moderator
  • Thanks for Konrad's help.

    Hi Peter,

    Sorry for my misunderstanding to this issue, I have unmarked the previous reply.

    I agree with Konrad's suggestion, based on your previous screen shot, it seems that you didn't debug your app. You could add a breakpoint, and then debug your app in your side. I think you could use the Immediate windows.

    Actually this forum is to discuss the VS IDE, not the real WinForm developing team members, sorry fro that I'm not very sure that how to use the settings option under the project property, but like the functions of the Immediate Window:

    The Immediate window is used to debug and evaluate expressions, execute statements, print variable values, and so forth. It allows you to enter expressions to be evaluated or executed by the development language during debugging.

    So if you want to print values, at least, we have to debug the app. 

    But if not debug the app, I could get the same result as yours.

    If you want to know more detailed information about the Settings under the project property, I think the WinForm forum would be better.

    If I have misunderstood this issue, please feel free to let me know.

    Thanks for Konrad's friendly assistance again:)

    Sincerely,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 22, 2016 6:45 AM
    Moderator
  • Hi!

    Just as a small extension:
    When using the Imediate Windows, Visual Studio will build the solution and start the debugger.

    So it is possible to use it. In my Test I created a project WindowsVBApplication1 and added a setting "Test". The following gave me the value of this Test setting:
    System.Windows.Forms.MessageBox.Show(Global.WindowsVBApplication1.My.Settings.Default.Test)

    With kind regards,

    Konrad

    Friday, April 22, 2016 6:58 AM
    Moderator
  • Yes, that was the problem. An Immediate Window query finds items in the My.Settings tree when the application is paused at a breakpoint during debugging, but gives the '"Settings" is not a member....' error if the application is not active. I think that this has to be regarded as (at least) a deficiency of the IDE, since autocomplete works normally in the Immediate Window to create the query under either circumstance.

    Peter R. Fletcher

    Friday, April 22, 2016 1:57 PM