Why is the properties not working RRS feed

All replies

  • Hello, 

    Не могу прочитать текст на картинке.

    Sincerely, Highly skilled coding monkey.

    Thursday, February 28, 2019 11:48 AM
  • Thursday, February 28, 2019 12:09 PM
  • Thursday, February 28, 2019 12:11 PM
  • The reference to Properties.Resources indicates you're trying to access the `settingsFilename` resource from the assembly. To do that you would have had to go to the project's properties in Solution Explorer, gone to the Resources tab and then added the (probably) string resource with the name `settingsFilename` and the value set to what you wanted. This would trigger the generation of the `Resources` class under the `Properties` folder of the project. Hence the generated class would have been `Properties.Resources`.

    However looking at your screenshot of the project you have no `Properties` folder or `Resources` file so you didn't do this in this project. Resources are internal to the project by default so if you defined the resource in a different project then you'd need to go back to the resources designer and change the accessibility of the generated class to public so it can be accessed outside the assembly.

    Note that if you want to be able to easily change this value then don't store it in the resources. Resources are for things that don't change very often but need to be swapped out, such as for localization. Configurable settings should be stored in the app's config file instead.

    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, February 28, 2019 3:03 PM
  • Would you like to view my project file

    Friday, March 1, 2019 7:06 AM
  • Did you verify you had a Resources file under your Properties folder in the project where you're trying to reference the Properties.Resources?

    Also note that resources are fully namespace qualified just like other identifiers. If you bring up the quick actions for the Properties identifier do you get the option to resolve it? If so then you have a namespace issue. Resources are put under the default namespace of the project (Project properties) and once added cannot be easily changed. If your code is not using that same namespace then you'll run into issues. In general it is better to simply reference Resources in your code and then use quick action to have it auto-generate the using statement for you.

    Michael Taylor http://www.michaeltaylorp3.net

    Friday, March 1, 2019 2:47 PM