Problem accessing a Resource through my C#class

Asked

Viewed 126 times

1

The problem is in a project I’m doing added 2 resources Main.resx I want to get data inside this Resource this way:

    System.Resources.ResourceManager rm = new ResourceManager(typeof(System.Resources_example.Main));

I have the Main.resx feature in my project but I can’t access it System.Resources_example.Main in this part of the code that error occurs Visual Studio does not recognize the Main.resx feature

  • What is System.Resources_example? You created a resrouce with namespace System? that typeof()refers to the class generated by .resx. Normally this class does not reside in the System namespace

  • @Alan Maik, I was having a similar problem, see if it helps you: https://answall.com/questions/199035/problema-ao-pega-key-de-arquivo-resx

  • @Artyou need a good example of how to use Resource: Resources.Main. Class is based on file name.

  • The name of My class is System.Resources_example the name of my Source is Main.resx I need to access it to consume the resources

  • It’s not just accessing directly: System.Resources_example.Main.??? the name of the resource?

  • Then I cannot access the resource when I put System.Resources_example. appears to me only the Program option does not appear my Resource

  • 1

    Open the Resource design and check the namespace if it is the same! or thing you left it with public?

  • 1

    Resolved by changing the namespace on Main.Designer.Cs was with the name of another project thank you !

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.