Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Help Needed Again: Funny Effects about My.Settings

Help Needed Again: Funny Effects about My.Settings

Scheduled Pinned Locked Moved Visual Basic
helpalgorithmstutorialquestionlearning
12 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sonhospa
    wrote on last edited by
    #1

    Hello again, unfortunately my problem (just below) looked like resolved, but something got completely twisted. Something seems to be really wrong in my Settings configuration, since I have the following effects: - In my main form, I have a custom control, which (of course) is initialized in the form designer. - A text field in it is supposed to open with a path retrieved from My.Settings, the UserSourcePath. - When debugging I stop the code during initialization in the line "Private _userSourcPath As String = My.Settings.UserSourcePath" and check for the value --> FUNNY: It' not the value that I have in the settings, but a value that I set at runtime when debugging before. :confused: Everything else seems to work quite normal, e.g. the settings I made show in the projects properties as supposed to. I have no idea where this alternative setting is stored i.e. from where it's retrieved. Searching the string with Ctrl-F doesn't give any results. Could someone please give me any hints how to resolve this strange effect? Where can I search for the string that's actually used instead of my intended setting? Thank you, Mick

    D 1 Reply Last reply
    0
    • S Sonhospa

      Hello again, unfortunately my problem (just below) looked like resolved, but something got completely twisted. Something seems to be really wrong in my Settings configuration, since I have the following effects: - In my main form, I have a custom control, which (of course) is initialized in the form designer. - A text field in it is supposed to open with a path retrieved from My.Settings, the UserSourcePath. - When debugging I stop the code during initialization in the line "Private _userSourcPath As String = My.Settings.UserSourcePath" and check for the value --> FUNNY: It' not the value that I have in the settings, but a value that I set at runtime when debugging before. :confused: Everything else seems to work quite normal, e.g. the settings I made show in the projects properties as supposed to. I have no idea where this alternative setting is stored i.e. from where it's retrieved. Searching the string with Ctrl-F doesn't give any results. Could someone please give me any hints how to resolve this strange effect? Where can I search for the string that's actually used instead of my intended setting? Thank you, Mick

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      I'm making some assumptions here because your post isn't specific. If the breakpoint is on that line, it hasn't executed the line yet. You have to step through that line to the next one to get it to execute. Now, if your "custom control" is in another project and you're putting settings in that project, it's not going to work. Settings will always come from the application you're using the control in, not the controls own settings file.

      A guide to posting questions on CodeProject

      Click this: Asking questions is a skill. Seriously, do it.
      Dave Kreskowiak

      S 1 Reply Last reply
      0
      • D Dave Kreskowiak

        I'm making some assumptions here because your post isn't specific. If the breakpoint is on that line, it hasn't executed the line yet. You have to step through that line to the next one to get it to execute. Now, if your "custom control" is in another project and you're putting settings in that project, it's not going to work. Settings will always come from the application you're using the control in, not the controls own settings file.

        A guide to posting questions on CodeProject

        Click this: Asking questions is a skill. Seriously, do it.
        Dave Kreskowiak

        S Offline
        S Offline
        Sonhospa
        wrote on last edited by
        #3

        Thank you, Dave. Sorry for not being specific enough. The breakpoint is on that line, as you assume, but I should be able to see (hovering) the value of "My.Settings.UserSourcePath". This was the case before as well as it is in a new project. Hovering over it, I see the wrong path which must be stored somewhere... The custom control is in the same project, just in a subdirectory named "Controls", and it's in the Namespace "Controls" as well. In the designer I assign the textfields value to "My.Settings.UserSourcePath" as well. Do you have further hints what to examine? EDIT / ADDITIONAL: I just played around with manually changing the settings and then debugging. That makes it even more funny, since I found that some of the values actually do come from the manual settings (main settings file), all of them referenced through "My.Settings.xxx". So the problem doesn't seem to be Namespaces related - I hope the assumption is ok. But how can I find out WHERE the variable "My.Settings.UserSourcePath" comes from, i.e. why I get my latest runtime entry instead of the actual setting????

        L 1 Reply Last reply
        0
        • S Sonhospa

          Thank you, Dave. Sorry for not being specific enough. The breakpoint is on that line, as you assume, but I should be able to see (hovering) the value of "My.Settings.UserSourcePath". This was the case before as well as it is in a new project. Hovering over it, I see the wrong path which must be stored somewhere... The custom control is in the same project, just in a subdirectory named "Controls", and it's in the Namespace "Controls" as well. In the designer I assign the textfields value to "My.Settings.UserSourcePath" as well. Do you have further hints what to examine? EDIT / ADDITIONAL: I just played around with manually changing the settings and then debugging. That makes it even more funny, since I found that some of the values actually do come from the manual settings (main settings file), all of them referenced through "My.Settings.xxx". So the problem doesn't seem to be Namespaces related - I hope the assumption is ok. But how can I find out WHERE the variable "My.Settings.UserSourcePath" comes from, i.e. why I get my latest runtime entry instead of the actual setting????

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Sonhospa wrote:

          Do you have further hints what to examine?

          Download Notepad++, do a "find in all files". Set the file-extensions to look for to ".cs", and search for your string. Your settings-file is a resource-file, and Visual Studio would generate some code for it; any settings-name should have a property. Search for it on the harddrive, and you'll find the location of your file. You now also know why most of us roll their own configuration-files :)

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

          S 1 Reply Last reply
          0
          • L Lost User

            Sonhospa wrote:

            Do you have further hints what to examine?

            Download Notepad++, do a "find in all files". Set the file-extensions to look for to ".cs", and search for your string. Your settings-file is a resource-file, and Visual Studio would generate some code for it; any settings-name should have a property. Search for it on the harddrive, and you'll find the location of your file. You now also know why most of us roll their own configuration-files :)

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

            S Offline
            S Offline
            Sonhospa
            wrote on last edited by
            #5

            Thank you, Eddy! In case you're still online: Does that method give different results than searching for the string in VS2010? Coz that's what I did already, searching for the String (the one that's not in the settings). I saw the code in the settings.designer file and in the settings.vb file, both hold the settings that I can see in the project properties, i.e. are correct. The string that appears (on hover) is the string that I entered at runtime (a different one for test purposes), and searching for it didn't bring any results. p.s.: Are you sure searching for ".cs" makes sense in a VB project? I'm asking seriously, as my programming knowledge is limited.

            D 1 Reply Last reply
            0
            • S Sonhospa

              Thank you, Eddy! In case you're still online: Does that method give different results than searching for the string in VS2010? Coz that's what I did already, searching for the String (the one that's not in the settings). I saw the code in the settings.designer file and in the settings.vb file, both hold the settings that I can see in the project properties, i.e. are correct. The string that appears (on hover) is the string that I entered at runtime (a different one for test purposes), and searching for it didn't bring any results. p.s.: Are you sure searching for ".cs" makes sense in a VB project? I'm asking seriously, as my programming knowledge is limited.

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Yes, the results will be different. The results in Visual Studio will only search the files that are visible in your project. Notepad++ will search ALL of the files in the project folder.

              A guide to posting questions on CodeProject

              Click this: Asking questions is a skill. Seriously, do it.
              Dave Kreskowiak

              S 1 Reply Last reply
              0
              • D Dave Kreskowiak

                Yes, the results will be different. The results in Visual Studio will only search the files that are visible in your project. Notepad++ will search ALL of the files in the project folder.

                A guide to posting questions on CodeProject

                Click this: Asking questions is a skill. Seriously, do it.
                Dave Kreskowiak

                S Offline
                S Offline
                Sonhospa
                wrote on last edited by
                #7

                Hi, I followed your advice (Eddy) with notepad++, setting the filter to "*.*" and searching for "My.Settings.UserSource_Path", because in initialization it's "nothing" which isn't a searchable string. I only get results from 2 vb-files, not even the settings.settings and settings.designer files of which I know they have the string in them. So this approach didn't help... Still can't find out why it's nothing instead of the project properties entry. Thank you though, Mick

                L 1 Reply Last reply
                0
                • S Sonhospa

                  Hi, I followed your advice (Eddy) with notepad++, setting the filter to "*.*" and searching for "My.Settings.UserSource_Path", because in initialization it's "nothing" which isn't a searchable string. I only get results from 2 vb-files, not even the settings.settings and settings.designer files of which I know they have the string in them. So this approach didn't help... Still can't find out why it's nothing instead of the project properties entry. Thank you though, Mick

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Sonhospa wrote:

                  Still can't find out why it's nothing instead of the project properties entry.

                  It is probably using settings from another location, with default values. Are you by any chance on a network where the users' home folders are mapped to a network drive?

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                  S 1 Reply Last reply
                  0
                  • L Lost User

                    Sonhospa wrote:

                    Still can't find out why it's nothing instead of the project properties entry.

                    It is probably using settings from another location, with default values. Are you by any chance on a network where the users' home folders are mapped to a network drive?

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                    S Offline
                    S Offline
                    Sonhospa
                    wrote on last edited by
                    #9

                    Hello Eddy, sorry for the late response, I didn't have access to programming stuff for a few days. While my VS2010 projects are on the "E:" harddrive, the user's folders (pictures, videos etc) are mapped to "F:\Media" on the same computer (separate harddrive). No network connections. I wonder what would cause such a twist... you seem to have an idea... Btw I'm under Win7-64bit.

                    L 1 Reply Last reply
                    0
                    • S Sonhospa

                      Hello Eddy, sorry for the late response, I didn't have access to programming stuff for a few days. While my VS2010 projects are on the "E:" harddrive, the user's folders (pictures, videos etc) are mapped to "F:\Media" on the same computer (separate harddrive). No network connections. I wonder what would cause such a twist... you seem to have an idea... Btw I'm under Win7-64bit.

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      It may be confusing where the system saves the settings, see vb.net - Where are application settings saved? - Stack Overflow[^] and Where are user-mode .NET settings stored? - Stack Overflow[^] Your files would need be saved somewhere, I'd expect them to be in that path. Search for the name of a setting, since the values would still be the default ones.

                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                      S 1 Reply Last reply
                      0
                      • L Lost User

                        It may be confusing where the system saves the settings, see vb.net - Where are application settings saved? - Stack Overflow[^] and Where are user-mode .NET settings stored? - Stack Overflow[^] Your files would need be saved somewhere, I'd expect them to be in that path. Search for the name of a setting, since the values would still be the default ones.

                        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                        S Offline
                        S Offline
                        Sonhospa
                        wrote on last edited by
                        #11

                        Hello, sorry again for the late response. With the help of your links (i.e. the articles) I was at least able to eliminate older/probably competing settings files and put most of the code into a new project which is running. Thank you for the advice, Eddy! I wish you a merry Christmas and a happy new year.

                        L 1 Reply Last reply
                        0
                        • S Sonhospa

                          Hello, sorry again for the late response. With the help of your links (i.e. the articles) I was at least able to eliminate older/probably competing settings files and put most of the code into a new project which is running. Thank you for the advice, Eddy! I wish you a merry Christmas and a happy new year.

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #12

                          You're welcome. Merry Christmas and happy new year to you also :)

                          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups