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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Setting Labels text specific to the current system culture .

Setting Labels text specific to the current system culture .

Scheduled Pinned Locked Moved C#
learning
1 Posts 1 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.
  • P Offline
    P Offline
    PranavThakur
    wrote on last edited by
    #1

    I am using the concept of satellite assembly in my application.I have created two satellite assemblies as Satellite.fr-FR.resources.dll and Satellite.en-US.resources.dll for french and english respectively. I have initialize resource manager as:- ResourceManager rm = new ResourceManager("Satellite." + System.Globalization.CultureInfo.CurrentCulture.Name, Assembly.GetExecutingAssembly()); From the above code the application automatically detects the current culture of the system.Depending on the current culture I am setting the labels text on a form like this:- private void button1_Click(object sender, EventArgs e) { SetText(this); } void SetText(Control ctl) { string text = rm.GetString(ctl.Name); if (text != null) ctl.Text = text; foreach (Control ctl1 in ctl.Controls) { SetText(ctl1); } } I am trying to find out a way by which my application set the Labels text itself when ever the system language changes. I mean i want to get rid of SetText() method written above.Is there any way by which I don't have to write any method like SetText() for setting all my controls text.If any one has any idea then please let me know. Thanks.

    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