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. C#
  4. calling resources

calling resources

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 2 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.
  • V Offline
    V Offline
    V 0
    wrote on last edited by
    #1

    Hi, I'm trying to call resources via the ResourceManager class. The idea is to be able to translate the application text when the application loads. I have tried the following: Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); ResourceManager resourcemanager = new ResourceManager("Resources", Assembly.GetExecutingAssembly()); and call a string: string info = resourcemanager.GetString("info_help"); ("info_help" is the name of the item in my Resources.en-US.resx file.) I get a MissingManifestResourceException error when the GetString method executes. What could be the problem here? tnx! [EDIT]MSDN is being a real b*tch to me on this subject... :( [/EDIT] Coulda, woulda, shoulda doesn't matter if you don't. -- modified at 5:46 Tuesday 25th April, 2006

    T 1 Reply Last reply
    0
    • V V 0

      Hi, I'm trying to call resources via the ResourceManager class. The idea is to be able to translate the application text when the application loads. I have tried the following: Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); ResourceManager resourcemanager = new ResourceManager("Resources", Assembly.GetExecutingAssembly()); and call a string: string info = resourcemanager.GetString("info_help"); ("info_help" is the name of the item in my Resources.en-US.resx file.) I get a MissingManifestResourceException error when the GetString method executes. What could be the problem here? tnx! [EDIT]MSDN is being a real b*tch to me on this subject... :( [/EDIT] Coulda, woulda, shoulda doesn't matter if you don't. -- modified at 5:46 Tuesday 25th April, 2006

      T Offline
      T Offline
      Tym
      wrote on last edited by
      #2

      Not sure if this will apply to your case, but I had a similar issue. I was simply trying to access an embedded resource of strings, no culture-specific stuff. I resolved it by qualifying the resource name with the assembly's default namespace: assembly name: MyAssembly default NameSpace: MyAssembly embedded resource: MyResources.resources ResourceManager rm = new ResourceManager("MyAssembly.MyResources", this.GetType().Assembly); string resourceValue = rm.GetString("resourceKey"); I had similar experiences with MSDN... Hope this helps. --Tym!

      V 1 Reply Last reply
      0
      • T Tym

        Not sure if this will apply to your case, but I had a similar issue. I was simply trying to access an embedded resource of strings, no culture-specific stuff. I resolved it by qualifying the resource name with the assembly's default namespace: assembly name: MyAssembly default NameSpace: MyAssembly embedded resource: MyResources.resources ResourceManager rm = new ResourceManager("MyAssembly.MyResources", this.GetType().Assembly); string resourceValue = rm.GetString("resourceKey"); I had similar experiences with MSDN... Hope this helps. --Tym!

        V Offline
        V Offline
        V 0
        wrote on last edited by
        #3

        tnx, I already solved the problem. It seems you have to add a resource to the project, I used (for the first one) the one that is there by default. Don't know where the difference is, but it works now. btw: i've tried this: ResourceManager rm = new ResourceManager("MyAssembly.MyResources", this.GetType().Assembly); string resourceValue = rm.GetString("resourceKey"); as first thing :-). Coulda, woulda, shoulda doesn't matter if you don't. :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig:

        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